Skip to content

AnimationPlayer onStart and onDone events emit only once #26630

@MurhafSousli

Description

@MurhafSousli

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions