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

1.2.0rc1 ngClass breaks enter animations #3727

Closed
gustly opened this issue Aug 23, 2013 · 17 comments
Closed

1.2.0rc1 ngClass breaks enter animations #3727

gustly opened this issue Aug 23, 2013 · 17 comments

Comments

@gustly
Copy link

gustly commented Aug 23, 2013

Plunker at http://plnkr.co/edit/1t54n1Y8ngIsRpaPlEWZ?p=preview

If you animate between two elements using enter and leave, and the class is set via the ngClass directive, the enter animation fails. This happens because the enter animation is triggered before ngClass is evaluated, and thus the new element does not yet have its animation CSS class set.

Note that we are using 1.2.0rc1

@matsko
Copy link
Contributor

matsko commented Aug 23, 2013

This should be fixed once these two PRs get in: #3715 and #3717.

Lets revisit this once they're in.

@gustly
Copy link
Author

gustly commented Aug 23, 2013

Thanks, @matsko.

On a local git repo, we merged in your pull requests into the master angular.js code. We tried both pull requests in isolation and also a merge of the two. In all three cases, the enter animations do not work as intended.

It seems like the initial CSS state never happens for the entering element. This is true even when we hard-code the class without using ngClass or interpolation. So perhaps it's unrelated to ngClass at all, and is a more fundamental problem with the enter animation. It appears that the "ng-enter-active" CSS class is being applied at the same time as the "ng-enter" class, and thus the animation jumps straight to the terminal style without first picking up its initial conditions.

The leave animation always works as intended.

Note that we have been looking at this in Mac Chrome 29.0.1547.57 thus far.

@matsko
Copy link
Contributor

matsko commented Aug 23, 2013

@gustly taking a look...

@matsko
Copy link
Contributor

matsko commented Aug 23, 2013

OK there is definitely something wrong. Working on a fix.

@gustly
Copy link
Author

gustly commented Aug 23, 2013

@matsko thanks, great to hear. Let us know if we can do anything to help.

Also, props on being so responsive.

@matsko
Copy link
Contributor

matsko commented Aug 23, 2013

Turns out that this isn't a bug with animations but with how ngInclude handles ngClass. A bug inside of a bug if you will. Good thing you pointed this out.

@gustly
Copy link
Author

gustly commented Aug 28, 2013

@matsko that's interesting. Although I am a bit confused because we also saw this behavior when hard-coding the class attribute (meaning we were not even using ngClass). Thoughts?

@matsko
Copy link
Contributor

matsko commented Aug 28, 2013

It's a strange race-condition that occurs when you insert nodes quickly into a page and attach a CSS class with transition effects. What happens is that the element node thinks that a transition is in progress so it skips the first CSS class (in this case the .ng-event class) and then jumps straight to the 2nd class.

Working on a solution now. Waiting for it to be reviewed + approved.

@matsko
Copy link
Contributor

matsko commented Aug 30, 2013

@matsko
Copy link
Contributor

matsko commented Aug 30, 2013

Ahhh looks like ngClass never makes it to ngView now. OK great this is an easy fix. Good thing that posted a fiddle link for me to test :)

@matsko
Copy link
Contributor

matsko commented Aug 30, 2013

@gustly
Copy link
Author

gustly commented Aug 30, 2013

@matsko awesome, we will try it out and report back.

@ludinov
Copy link

ludinov commented Sep 3, 2013

After I toggle class for root element with ng-class ( or in some cases just for any parent ) - animations stop working.
http://plnkr.co/edit/PcQPY5?p=preview

matsko added a commit to matsko/angular.js that referenced this issue Sep 3, 2013
matsko added a commit to matsko/angular.js that referenced this issue Sep 3, 2013
@matsko matsko closed this as completed in 36ad40b Sep 4, 2013
matsko added a commit that referenced this issue Sep 4, 2013
@matsko
Copy link
Contributor

matsko commented Sep 4, 2013

@gustly please use master to see if things are working.

@gustly
Copy link
Author

gustly commented Sep 4, 2013

@matsko sounds good, will get to this today.

@matsko
Copy link
Contributor

matsko commented Sep 4, 2013

@gustly this is made it to RC2 so just use that code: http://code.angularjs.org/1.2.0-rc.2/

@gustly
Copy link
Author

gustly commented Sep 4, 2013

@matsko we tried it out and everything seems to work well. Nice work.

jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Sep 25, 2013
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants