Repository navigation
Closed as not planned
Labels
P4A relatively minor issue that is not relevant to core functionsarea: animationslegacy animations package only. Otherwise use area: core.freq2: mediumtype: bug/fix
Milestone
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Current behavior
I wanted my directive plays an animation on host element while certain conditions met. To iterate animation, I shortly played with animation-iteration-count with no success, managed to make it work using AnimationPlayer.play(), reset() and onDone(GitHub repo here).
But if it played an animation then the host component gets destroyed, it throws:
ERROR Error: Uncaught (in promise): Error: Unable to find the timeline player referenced by 1
Error: Unable to find the timeline player referenced by 1
at TimelineAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.TimelineAnimationEngine._getPlayer (browser.js:2183)
at TimelineAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.TimelineAnimationEngine.command (browser.js:2203)
at InjectableAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.AnimationEngine.process (browser.js:3786)
at AnimationRenderer.push../node_modules/@angular/platform-browser/fesm5/animations.js.AnimationRenderer.setProperty (animations.js:288)
at issueAnimationCommand (animations.js:96)
at RendererAnimationPlayer.push../node_modules/@angular/platform-browser/fesm5/animations.js.RendererAnimationPlayer._command (animations.js:75)
at RendererAnimationPlayer.push../node_modules/@angular/platform-browser/fesm5/animations.js.RendererAnimationPlayer.reset (animations.js:90)
at NgIdleClickDirective.push../dist/ng-idle-click/fesm5/ng-idle-click.js.NgIdleClickDirective.playDefaultAnimation (ng-idle-click.js:165)
at NgIdleClickDirective.animationDone (ng-idle-click.js:78)
at animations.js:172
at TimelineAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.TimelineAnimationEngine._getPlayer (browser.js:2183)
at TimelineAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.TimelineAnimationEngine.command (browser.js:2203)
at InjectableAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.AnimationEngine.process (browser.js:3786)
at AnimationRenderer.push../node_modules/@angular/platform-browser/fesm5/animations.js.AnimationRenderer.setProperty (animations.js:288)
at issueAnimationCommand (animations.js:96)
at RendererAnimationPlayer.push../node_modules/@angular/platform-browser/fesm5/animations.js.RendererAnimationPlayer._command (animations.js:75)
at RendererAnimationPlayer.push../node_modules/@angular/platform-browser/fesm5/animations.js.RendererAnimationPlayer.reset (animations.js:90)
at NgIdleClickDirective.push../dist/ng-idle-click/fesm5/ng-idle-click.js.NgIdleClickDirective.playDefaultAnimation (ng-idle-click.js:165)
at NgIdleClickDirective.animationDone (ng-idle-click.js:78)
at animations.js:172
at resolvePromise (zone.js:814)
at zone.js:877
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:4053)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:595)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500)
at invokeTask (zone.js:1540)
at IDBRequest.globalZoneAwareCallback (zone.js:1566)
Expected behavior
AnimationPlayer didn't throw when a player is being reused by calling reset() / destroy() and play().
Minimal reproduction of the problem with instructions
Tried to reproduce on Stackblitz but couldn't (it didn't throw).
Could reproduce on live app by following steps below:
- Log in here
- On devtools' network tab, throttle with long latency, say 2.5s to make it animate
- Go into
Issuesgroup, add any note and save (button should be animated) - Click user photo and logout (should throw)
What is the motivation / use case for changing the behavior?
Environment
Angular version: 6.0.3
Browser:
- [x] Chrome (desktop) version 69
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 8.11.2
- Platform: Windows
Others:
Reacted by Yohanes Oktavianus Lumentut, David Silva, Murhaf Sousli and Alex Skoropad
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsarea: animationslegacy animations package only. Otherwise use area: core.freq2: mediumtype: bug/fix
Activity
MurhafSousli commentedon Oct 20, 2018
I have the same issue, I want to play leave animation on child elements when the parent component is destroyed but the player throws the same error
qaxqaxqax commentedon Nov 22, 2020
Hello,
Let me share my experience about this behaviour. I had a very similar error message when I created two players from the same AnimationFactory. For the first play the onDone method have not been called after the second play it turned into the error. My workaround was to build a new instance from the animation factory with the same parameters and create two independent players. Error gone.
intellix commentedon Jan 31, 2021
This ones killing us as well. There seems to be a memory leak in animating the same element over and over again as can be seen here: https://stackblitz.com/edit/angular-ivy-basic-animation
To get around it, we destroy the previous player beforehand and that seems to fix it. Now we're getting this thrown:
Tried doing a setTimeout(() => ) around the next play but it doesn't seem to matter. The whole thing just throws randomly. I think the only workaround right now is to wrap the destroy in a try/catch?
NicoBrg-WDG commentedon May 27, 2023
I ran into the same problem today when animating the same few divs over and over with to different animations (slide in, slide out).
At first, each time I wanted to animate a div I was creating a new factory and a new player with no concern for memory just to test this player thing. After making it work like I wanted I tried to write cleaner code by:
I tried all the combinations but the reset thing didn't seem to work, so I tried to call destroy() on the existing player and create a new one, but the destroy() call was throwing the
Unable to find the timeline player referenced by 1error. I checked my code and I was only calling destroy() only once so I expected the player to be destroyed properly.By debugging the destroy() method in Chrome Dev Tools I noticed that even though my destroy() call was failing, the browser was still holding references to multiple other players. The weird thing was that all the players had the same id, either 0 or 1, not sur how this is possible.
In my case I figured that having my 2 factories in variables that I was calling to create players seemed to result in this weird behavior, so now I create a factory each time I create a player, and I call destroy() on each player before creating a new one, it all seems to work. No player is left behind.
thePunderWoman commentedon Aug 21, 2025
This issue was closed as obsolete due to the introduction of the new
animate.enterandanimate.leaveAPIs. The@angular/animationspackage is now deprecated and will be removed in Angular v23. We hope you give the new APIs a try.angular-automatic-lock-bot commentedon Sep 21, 2025
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.