This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngShow gives inconsistent results with ngAnimate #11717
Comments
You can see that commenting |
Did that happen before (in 1.3.x)? |
Still a problem in the latest rc |
matsko
added a commit
to matsko/angular.js
that referenced
this issue
Apr 29, 2015
…class is added/removed when removed/added This patch ensures that if the same CSS class is added/removed within a follow-up digest then the previous class-based animation is cancelled beforehand. Closes angular#11717
This PR should fix it: #11755 |
Great! I ported the PR to my local copy. It does fix the issue. |
petebacondarwin
pushed a commit
to petebacondarwin/angular.js
that referenced
this issue
May 22, 2015
…class is added/removed when removed/added This patch ensures that if the same CSS class is added/removed within a follow-up digest then the previous class-based animation is cancelled beforehand. Closes angular#11717
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 22, 2015
…class is added/removed when removed/added This patch ensures that if the same CSS class is added/removed within a follow-up digest then the previous class-based animation is cancelled beforehand. Closes angular#11717
matsko
added a commit
to matsko/angular.js
that referenced
this issue
May 26, 2015
…class is added/removed when removed/added This patch ensures that if the same CSS class is added/removed within a follow-up digest then the previous class-based animation is cancelled beforehand. Closes angular#11717
matsko
added a commit
to matsko/angular.js
that referenced
this issue
May 26, 2015
…class is added/removed when removed/added This patch ensures that if the same CSS class is added/removed within a follow-up digest then the previous class-based animation is cancelled beforehand. Closes angular#11717
netman92
pushed a commit
to netman92/angular.js
that referenced
this issue
Aug 8, 2015
…class is added/removed when removed/added This patch ensures that if the same CSS class is added/removed within a follow-up digest then the previous class-based animation is cancelled beforehand. Closes angular#11717
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
ng-show
gives inconsistent results when the watched valued is changed multiple time in the same digest cycle andngAnimate
is included.Here is a simple reproduction with
1.4.0-rc.0
: http://jsfiddle.net/dubejf/xz6ppj9v/2/vm.showIt
.ng-show
directive, withng-show="vm.showIt"
.true
, then to set it tofalse
. The value are changed using a$timeout
, in the hope that theng-show
watch will update twice in the same digest.Expected behavior: Click on 'Click me'. At the end of the digest,
vm.showIt
should always befalse
. The red div should always be invisible.Actual behavior:
vm.showIt
is alwaysfalse
at the end of the cycle (good). The red div is sometime visible, sometime invisible (bad).The behavior is easier to observe in Firefox r37, where the fiddle gives the wrong results half the time. The bad behavior can also be observed in Chrome r42, with less consistency - I haven't been able to figure the pattern, you may need a few dozen push of the button to make it fail.
When the test fails (red div visible), the class 'ng-hide' is missing on the div. The class should be set, because the condition for
ng-show
isfalse
.The root of the problem appears to be the handling of classes inside the
$animate
service, specifically when successive calls toremoveClass
\addClass
are made.The problem only occurs when the
ngAnimate
module is included. Tested with1.4.0-rc.0
and1.4.0-build.3988
.The text was updated successfully, but these errors were encountered: