Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ng-class on html tag kills animation after triggering #4231

Closed
meeroslav opened this issue Oct 2, 2013 · 1 comment · Fixed by #4573
Closed

ng-class on html tag kills animation after triggering #4231

meeroslav opened this issue Oct 2, 2013 · 1 comment · Fixed by #4573
Assignees

Comments

@meeroslav
Copy link

When adding conditional classes with on html tag (with ng-class), setting it off for the first time kills all the animations on page as it removes animate state from html tag.

You can see example here: http://plnkr.co/edit/nbganjCblEL4Oj2hm6Y5

If you click on 2nd link animation would be toggled endlessly. Clicking on first link runs the animation only first time. All subsequent clicks will not animate.

I've investigated this and realized that during the animation, performAnimation checks for parent.inheritedData(NG_ANUMATE_STATE) which translates eventually to $(html).data('$$ngAnimateState'). If successfull, adds animateState to element animated and after animation was done removes it. When using ng-class on HTML tag,
animate state is add and removed from html tag.
As a result:

parent.inheritedData(NG_ANIMATE_STATE) || disabledAnimation).running

is always true after that point, thus bailing out of all the subsequent animations.

@ghost ghost assigned matsko Oct 2, 2013
@matsko
Copy link
Contributor

matsko commented Oct 12, 2013

Ahh this is the animation thread that I was looking for. I made a PR a few weeks ago. Just need to update it and fix a few things: #3892

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants