angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

ng-animate : nesting animations / running multiple animations at once

Open bbshopadmin opened this issue 12 years ago • 7 comments

Generally i want to nest javascript animations.

I try to animate page changes with ng-view and child elements of these views with ng-show simultaneously, but the child element's animations are ignored. It looks like they're skipped, 'removeClass' doesn't get called. Delaying the child animations until the parent's ng-view animation is complete works. Is that behaviour intended?

bbshopadmin avatar Jul 02 '14 16:07 bbshopadmin

I believe this just became possible with commit https://github.com/angular/angular.js/commit/8252b8be946367f1759065adf528adc908da00a2, which will be part of the next beta. Can you check if this solves your problem?

Narretz avatar Jul 02 '14 20:07 Narretz

I tried the master branch (was using v1.2.19 before) but no luck.

Using a custom directive instead of ng-show seems to work (as a workaround).

In the meantime i found this post: http://jamiecopeland.com/2014/05/06/angular-nested-animation-issues/

bbshopadmin avatar Jul 02 '14 23:07 bbshopadmin

Have you noticed that the new behavior is opt-in? You need to add ng-animate-children to the parent directive for child elements to animate at the same time. Would be good to see a simple plnkr of something you are trying to achieve.

Narretz avatar Jul 03 '14 06:07 Narretz

Works! I missed adding ng-animate-children. Thank you.

Are these changes to ngAnimate only in the 1.3 branch? I had to fetch 1.3.0-build.2879+sha.4a8bffe. How do i get that with 1.2.x?

bbshopadmin avatar Jul 03 '14 13:07 bbshopadmin

Let's ask @matsko if it's possible to backport this to 1.2

Narretz avatar Jul 03 '14 13:07 Narretz

Yes, placing this into 1.2 should be OK since there is a need for it.

matsko avatar Jul 03 '14 16:07 matsko

Landed as https://github.com/angular/angular.js/commit/931789ec1476e1d06739e63cb423eb87172b5ebc

matsko avatar Jul 03 '14 16:07 matsko