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
AnimationPlayer onStart and onDone events emit only once #26630
Comments
This is really annoying, as it defeats the reusability purpose of the AnimationPlayer. Angular 8.0 issue reproduced here: https://stackblitz.com/edit/angular-na3vhi |
I've discovered that you can make the same player emit again but you need to register the callback for every single play. this.releasedOver$.subscribe(() => {
this.animation.play()
this.animation.onDone(() => this.animation?.reset())
}) I'm rolling with this as a solution for the time being but if and when you solve this problem it would be great if it ships with a deprecation warning so that I (/we) don't end up with memory leaks. Thank you! |
in the animation players, don't delete the _onStartFns and _onDoneFns after they have been called so that they can be called again after resetting the animation also set the _finished to false when the animation player starts (so that the done functions can also be re-triggered) resolves angular#26630
in the animation players, make sure than upon reset the _onStartFns and _onDoneFns are also re-applied so that they can be called again after resetting the animation also set the noop animation player's _finished to false when the player resets (needed to make sure that the _onDoneFns get called) resolves angular#26630
in the animation players, make sure than upon reset the _onStartFns and _onDoneFns are also re-applied so that they can be called again after resetting the animation also set the noop animation player's _finished to false when the player resets (needed to make sure that the _onDoneFns get called) resolves angular#26630
in the animation players, make sure than upon reset the _onStartFns and _onDoneFns are also re-applied so that they can be called again after resetting the animation also set the noop animation player's _finished to false when the player resets (needed to make sure that the _onDoneFns get called) resolves #26630 PR Close #46364
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
AnimationPlayer
onStart
andonDone
events emit only once, a new player has to be created to get the events to work againExpected behavior
AnimationPlayer
onStart
andonDone
events should work again after the first playMinimal reproduction of the problem with instructions
https://stackblitz.com/edit/angular-bynhgg?file=src/app/app.component.ts
What is the motivation / use case for changing the behavior?
Be able to reuse the player
Environment
Could be related to #26095
The text was updated successfully, but these errors were encountered: