-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Bug ngAnimate 1.2.0-rc2 with side effects on watches on form$invalid when combined with ng-if in some inputs #4226
Comments
Just to point out, if you watch Updated fiddle: http://jsfiddle.net/8s6r2/2/ |
@matsko Actually, it isn't. Un-ticking the first box (after ticking it) should re-enable the button, but it doesn't. In my comment, I was just pointing out how the change seems to get queued (if you look at it in the console). |
Alright I see it now. Looking into it. |
The issue here is the different behavior of the function angular leave(): leave : function(element, done) {
element.remove();
done && $timeout(done, 0, false);
}, angular-animate leave(): leave : function(element, done) {
cancelChildAnimations(element);
this.enabled(false, element);
$rootScope.$$postDigest(function() {
performAnimation('leave', 'ng-leave', element, null, null, function() {
$delegate.leave(element, done);
});
});
}, On unchecking the option, the digest loops watcher on But in angular-animate the Have no solution, though. Just research :( |
Yes, the issue with this is leave. And @IgorMinar has a fix in mind which he is putting together. |
Due to animations, DOM might get destroyed much later than scope and so the element $destroy event might get fired outside of $digest, which causes changes to the validation model go unobserved until the next digest. By deregistering on scope event, the deregistration always happens in $digest and the form validation model changes will be observed. Closes angular#4226 Closes angular#4779
Due to animations, DOM might get destroyed much later than scope and so the element $destroy event might get fired outside of $digest, which causes changes to the validation model go unobserved until the next digest. By deregistering on scope event, the deregistration always happens in $digest and the form validation model changes will be observed. Closes angular#4226 Closes angular#4779
I am wathcing a strange behavior when including ngAnimate as dependency.
I have a button with ng-disabled="$form.invalid" which is not being updated on some user events made on the form.
Here is an example ro reroduce the bug
Here the steps to reproduce the bug:
1 - fill some text in text box 'Required Input' (the button becomes enabled)
2 - check Option 1 (the button becomes disabled)
3 - fill textarea of Option 1 (the button becomes enabled)
4 - check Option 2 (the button becomes disabled)
5 - uncheck Option 2 the button remains disabled, which is not correct
Now, if we do not include ngAnimate as dependency
1 - fill some text in text box 'Required Input' (the button becomes enabled)
2 - check Option 1 (the button becomes disabled)
3 - fill textarea of Option 1 (the button becomes enabled)
4 - check Option 2 (the button becomes disabled)
5 - uncheck Option 2 the button becomes enabled which is correct
Here is a jsfiddle http://jsfiddle.net/bfcamara/8s6r2/
The text was updated successfully, but these errors were encountered: