Angular: AnimationPlayer onStart and onDone events emit only once

Created on 21 Oct 2018  ·  1Comment  ·  Source: angular/angular

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

AnimationPlayer onStart and onDone events emit only once, a new player has to be created to get the events to work again

Expected behavior

AnimationPlayer onStart and onDone events should work again after the first play

Minimal reproduction of the problem with instructions

  this.animationBuilder.build([
      query(
        '.child-element',
        [
          stagger(100, [useAnimation(animation)])
        ]
      )
    ]);
    this.player = builder.create(this.el.nativeElement);
    this.player.onStart(() => {
      console.log('animation onStart');
    });
    this.player.onDone(() => {
      console.log('animation onDone');
    });

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


Angular version: 7.0.0


Browser:
- [x ] Chrome (desktop) version XX
- [ ] 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  
- Platform:  Windows

Others:

Could be related to #26095

P4 animations high bufix

Most helpful comment

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

>All 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

Was this page helpful?
0 / 5 - 0 ratings