Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ng-dirty class for a control that was not touched
Message
 
 
À
09/03/2015 09:39:33
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01616375
Message ID:
01616488
Vues:
25
The $render function does the following:
controller.$render = function () {
                        var viewValue = controller.$viewValue;
                         if (viewValue) {
                            var date = moment(viewValue);
                            if (angular.isDefined(date) && date != null && moment.isMoment(date)) {
                                datetimepicker.data('DateTimePicker').date(date);
                            }
                        } else {
                            datetimepicker.data('DateTimePicker').date(setCalendarPickerStartDate());
                            datetimepicker.data('DateTimePicker').date();
                        }
                        return controller.$viewValue;
                    };
So, I believe that datetimepicker.data('DateTimePicker').date(date); causes the onblur event to fire

as we have
scope.$watch('ngModel', function () {
                        validate();
                        datetimepicker.on('dp.change', updateModel).on('blur', onblur);
                    });
I'll try to add a new variable that will tell me what kind of change it was.

Looking closer I think the code that causes the problem is this:
 scope.$watch('ngModel', function () {
                        validate();
                        datetimepicker.on('dp.change', updateModel).on('blur', onblur);
                    });
I've been tracing and I can see that angular sets the control dirty in that watch check.
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