Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to use disable option of ng-options
Message
 
 
À
Tous
Information générale
Forum:
AngularJS
Catégorie:
Codage, syntaxe et commandes
Titre:
Trying to use disable option of ng-options
Divers
Thread ID:
01647803
Message ID:
01647803
Vues:
52
UPDATE. I think I figured this out - simple, I'm missing option.disabled here. I'll re-test.

UPDATE 2. After I added disable when option.disabled I am no longer seeing correctly the initial value of the form type for some reason.

Hi everybody,

I am trying the following select
<select id="formType" class="form-control" name="formType"
                            ng-model="currentMessage.formType" size="1" convert-to-number
                            ng-change="formTypeChange()"
                            ng-options="option.value as option.text disable when disabled for option in metaData.messageTypes"></select>
and in the formTypeChange method I have the following code:
 $scope.formTypeChange = function()
            {
                if ($scope.currentMessage.formType==3) // e-mail
                {
                    $scope.currentMessage.recipients = $scope.selections.selectedGuests.filter(function (element) {
                        return element.eMail!=="";
                    });
                    
                    $scope.metaData.messageTypes[2].disabled = $scope.currentMessage.recipients.length == 0;
                }
                else
                {
                    $scope.currentMessage.recipients = $scope.selections.selectedGuests;

                }

                $scope.recipients.body.rows = $scope.currentMessage.recipients;
            }
I can see that my recipients are properly filtered, but the e-mail option is not becoming disabled. Do you see what am I doing wrongly?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform