Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Does ngChange automatically cause select become dirty?
Message
 
 
À
14/11/2016 12:30:14
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01643370
Message ID:
01643398
Vues:
20
>>Hi everybody,
>>
>>I have a directive which is a mover list.
>>
>>Normally when I select items in either of the lists the control marks itself as dirty. I am wondering if this is the normal behavior and by design?
>
>I would have thought 'by design' - what other behaviour would you expect ?
>
>>I added a new property keepPristine. I'm wondering if I should explicitly re-set the control's dirty state in ng-change event of both lists?
>>
>>Adding this code
>>
>>
>> $scope.onChanged = function (assigned) {
>>                    $scope.selectedItem = assigned[0];
>>                    if ($scope.keepPristine)
>>                    {
>>                        $scope.form.assignedList.$pristine = true;
>>                        $scope.form.unAssignedList.$pristine = true;
>>                    }
>>                }
>>
>>does not help :( My select list still shows ng-dirty flag when I examine it using Inspect option.
>>
>>Thanks in advance.
>
>Will this help : http://stackoverflow.com/questions/28721959/angular-1-2-is-it-possible-to-exclude-an-input-on-form-dirty-checking

Yes, I'll try using our existing directive no-dirty-check and incorporate it directly into the 2 select controls we have in that directive, e.g. I add to the selects

no-dirty-check=keepPristine

I'll play with it and let you know.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform