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

ngAnimate (stagger) only animates first element in repeater #7228

Closed
gbbr opened this issue Apr 24, 2014 · 13 comments
Closed

ngAnimate (stagger) only animates first element in repeater #7228

gbbr opened this issue Apr 24, 2014 · 13 comments

Comments

@gbbr
Copy link

gbbr commented Apr 24, 2014

This issue happens most often on Chrome browser (MacOS in my case). It can be reproduced on http://www.ng-tube.com/#/ by switching between the categories located on the top right.

There is also a StackOverflow entry that shows an example of the issue, as well as a solution. There seem to be differences between 1.2.13 and 1.2.9 (see http://www.stackoverflow.com/questions/23176807/angularjs-only-first-element-in-ng-repeat-animates).

AngularJS is a great framework but the most essential thing (in my opinion) are animations. I've gone through hours of stress trying to pull them off with zero luck.

@gbbr gbbr changed the title ng-animate only animates first element in repeater animate only animates first element in repeater Apr 24, 2014
@gbbr gbbr changed the title animate only animates first element in repeater ngAnimate only animates first element in repeater Apr 24, 2014
@lefos987
Copy link
Contributor

Which version of Angular are you using? As suggested in StackOverflow have you tried the latest Angular version?

@gbbr
Copy link
Author

gbbr commented Apr 24, 2014

I am using AngularJS 1.2.9 and it is not working, it seems to behave significantly better with 1.2.13. Do check ng-tube as well this is a real issue. This is my styling https://github.com/backslashed/room24/blob/master/styles/sass/_animations.scss

I'm 100% sure everything is correct on my side.

@nerdfiles
Copy link

Is this issue browser-dependent?

@gbbr
Copy link
Author

gbbr commented Apr 28, 2014

It happens on all browsers 90% of the time. It is less obvious on Safari and most obvious on Chrome, to me it looks like a timing issue. I will continue to study the source code of ngAnimate and will try to help come up with a patch. It's amazing that no one has noticed this so far.

To clarify, this happens when you replace the entire data set of the repeater.

@gbbr gbbr changed the title ngAnimate only animates first element in repeater ngAnimate (stagger) only animates first element in repeater Apr 28, 2014
@matsko
Copy link
Contributor

matsko commented May 24, 2014

#7547 is related. Working on a fix.

@matsko matsko self-assigned this May 24, 2014
@matsko
Copy link
Contributor

matsko commented May 24, 2014

The ng-tube website is using an older version of ngAnimate, so the newer ones fixed it up into a much better state. Although there is an another issue in the comment above. Hopefully once this is fixed then it should be stable.

@matsko
Copy link
Contributor

matsko commented May 30, 2014

@Backslashed do you have any other example aside from the one from ng-tube?

@gbbr
Copy link
Author

gbbr commented May 30, 2014

@matsko I did, but i've fixed it now by refactoring using TweenMax. The older non-working version of my project is at https://github.com/backslashed/room24/blob/master/app/controllers/CategoryController.js - the SASS / CSS is also there in a different folder. Basically the issue happens when you switch out the contents of the repeater with new items.

Hope that helps.

P.S. My post on StackOverflow (link in the first comment in this thread) might be of help as well. Good luck :)

@Narretz Narretz added this to the Backlog milestone Jul 1, 2014
@matsko
Copy link
Contributor

matsko commented Jul 1, 2014

@Backslashed sorry, I missed your message about a month ago. Could you possibly help put together a standalone ZIP file containing an app where this effect is easy to reproduce? This is a difficult bug to pin down.

@gbbr
Copy link
Author

gbbr commented Jul 2, 2014

I could fork Angular and write a test case that fails for this scenario. Which file should I put it in? Your tests seem mostly TDD and this would be a BDD test.

@gbbr
Copy link
Author

gbbr commented Jul 2, 2014

P.S. I have provided a very basic example since my first post. Follow the StackOverflow link and look at the first answer. It has 2 demos on plunkr that reproduce the problem. I have mentioned this above.

matsko added a commit to matsko/angular.js that referenced this issue Aug 16, 2014
…mations

When transition-delay and animation-delay were used to drive the staggering
animation the result was unpredictable at times due to the browser not being
able to register the generated delay styles in time. This caused a hard to
track down bug that didn't have a solid solution when styles were being used.

This fix ensures that stagger delays are handled by the $timeout service.

Closes angular#7547
Closes angular#7228

BREAKING CHANGE

If any stagger code consisted of having BOTH transition staggers and delay staggers
together then that will not work the same way. Angular will no instead choose
the highest stagger delay value and set the timeout to wait for that before
applying the active CSS class.
matsko added a commit to matsko/angular.js that referenced this issue Aug 16, 2014
…mations

When transition-delay and animation-delay were used to drive the staggering
animation the result was unpredictable at times due to the browser not being
able to register the generated delay styles in time. This caused a hard to
track down bug that didn't have a solid solution when styles were being used.

This fix ensures that stagger delays are handled by the $timeout service.

Closes angular#7547
Closes angular#7228

BREAKING CHANGE

If any stagger code consisted of having BOTH transition staggers and delay staggers
together then that will not work the same way. Angular will no instead choose
the highest stagger delay value and set the timeout to wait for that before
applying the active CSS class.
matsko added a commit to matsko/angular.js that referenced this issue Aug 16, 2014
…mations

When transition-delay and animation-delay were used to drive the staggering
animation the result was unpredictable at times due to the browser not being
able to register the generated delay styles in time. This caused a hard to
track down bug that didn't have a solid solution when styles were being used.

This fix ensures that stagger delays are handled by the $timeout service.

Closes angular#7547
Closes angular#7228

BREAKING CHANGE

If any stagger code consisted of having BOTH transition staggers and delay staggers
together then that will not work the same way. Angular will no instead choose
the highest stagger delay value and set the timeout to wait for that before
applying the active CSS class.
@matsko
Copy link
Contributor

matsko commented Aug 16, 2014

This should be fixed with #8637. And it already fixes #7547.

You can test out the JS files here:
https://s3.amazonaws.com/angularjs-dev/class-based-fixes/angular.js
https://s3.amazonaws.com/angularjs-dev/class-based-fixes/angular-animate.js

matsko added a commit to matsko/angular.js that referenced this issue Aug 16, 2014
…mations

When transition-delay and animation-delay were used to drive the staggering
animation the result was unpredictable at times due to the browser not being
able to register the generated delay styles in time. This caused a hard to
track down bug that didn't have a solid solution when styles were being used.

This fix ensures that stagger delays are handled by the $timeout service.

Closes angular#7547
Closes angular#7228
Closes angular#8547

BREAKING CHANGE

If any stagger code consisted of having BOTH transition staggers and delay staggers
together then that will not work the same way. Angular will no instead choose
the highest stagger delay value and set the timeout to wait for that before
applying the active CSS class.
matsko added a commit to matsko/angular.js that referenced this issue Aug 16, 2014
…mations

When transition-delay and animation-delay were used to drive the staggering
animation the result was unpredictable at times due to the browser not being
able to register the generated delay styles in time. This caused a hard to
track down bug that didn't have a solid solution when styles were being used.

This fix ensures that stagger delays are handled by the $timeout service.

Closes angular#7228
Closes angular#7547
Closes angular#8297
Closes angular#8547

BREAKING CHANGE

If any stagger code consisted of having BOTH transition staggers and delay staggers
together then that will not work the same way. Angular will no instead choose
the highest stagger delay value and set the timeout to wait for that before
applying the active CSS class.
matsko added a commit to matsko/angular.js that referenced this issue Aug 16, 2014
…mations

When transition-delay and animation-delay were used to drive the staggering
animation the result was unpredictable at times due to the browser not being
able to register the generated delay styles in time. This caused a hard to
track down bug that didn't have a solid solution when styles were being used.

This fix ensures that stagger delays are handled by the $timeout service.

Closes angular#7228
Closes angular#7547
Closes angular#8297
Closes angular#8547

BREAKING CHANGE

If any stagger code consisted of having BOTH transition staggers and delay staggers
together then that will not work the same way. Angular will no instead choose
the highest stagger delay value and set the timeout to wait for that before
applying the active CSS class.
@gbbr
Copy link
Author

gbbr commented Aug 16, 2014

That's awesome man! 👍

matsko added a commit to matsko/angular.js that referenced this issue Aug 19, 2014
…mations

When transition-delay and animation-delay were used to drive the staggering
animation the result was unpredictable at times due to the browser not being
able to register the generated delay styles in time. This caused a hard to
track down bug that didn't have a solid solution when styles were being used.

This fix ensures that stagger delays are handled by the $timeout service.

Closes angular#7228
Closes angular#7547
Closes angular#8297
Closes angular#8547

BREAKING CHANGE

If any stagger code consisted of having BOTH transition staggers and delay staggers
together then that will not work the same way. Angular will no instead choose
the highest stagger delay value and set the timeout to wait for that before
applying the active CSS class.
@btford btford removed the gh: issue label Aug 20, 2014
matsko added a commit to matsko/angular.js that referenced this issue Aug 25, 2014
…mations

When transition-delay and animation-delay were used to drive the staggering
animation the result was unpredictable at times due to the browser not being
able to register the generated delay styles in time. This caused a hard to
track down bug that didn't have a solid solution when styles were being used.

This fix ensures that stagger delays are handled by the $timeout service.

Closes angular#7228
Closes angular#7547
Closes angular#8297
Closes angular#8547

BREAKING CHANGE

If any stagger code consisted of having BOTH transition staggers and delay staggers
together then that will not work the same way. Angular will no instead choose
the highest stagger delay value and set the timeout to wait for that before
applying the active CSS class.
matsko added a commit to matsko/angular.js that referenced this issue Aug 26, 2014
…mations

When transition-delay and animation-delay were used to drive the staggering
animation the result was unpredictable at times due to the browser not being
able to register the generated delay styles in time. This caused a hard to
track down bug that didn't have a solid solution when styles were being used.

This fix ensures that stagger delays are handled by the $timeout service.

Closes angular#7228
Closes angular#7547
Closes angular#8297
Closes angular#8547

BREAKING CHANGE

If any stagger code consisted of having BOTH transition staggers and delay staggers
together then that will not work the same way. Angular will now instead choose
the highest stagger delay value and set the timeout to wait for that before
applying the active CSS class.
@matsko matsko closed this as completed in 23da614 Aug 26, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.