Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation stops after a few updates on Chapter 1 Step 10 #5

Open
jaridmck opened this issue Apr 8, 2016 · 0 comments
Open

Animation stops after a few updates on Chapter 1 Step 10 #5

jaridmck opened this issue Apr 8, 2016 · 0 comments

Comments

@jaridmck
Copy link

jaridmck commented Apr 8, 2016

Likely this is because I'm using a newer version of Angular, but I ran into an issue where the animations stopped after each element had been updated once up and once down. Here is the code in the book:

$animate.addClass($element, 'change-' + direction, function() {
  $animate.removeClass($element, 'change-' + direction);
});

I think the code is attempting to remove the class before the animation is complete and causing a problem.To solve this, I modified the above code slightly to make sure that the directive only continues once the animation promise from the addClass function has been returned:

$animate.addClass($element, 'change-' + direction).then( function() {
  $animate.removeClass($element, 'change-' + direction);
});

Reference

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

No branches or pull requests

1 participant