Adam Jenkins
Adam Jenkins

Reputation: 55772

angular reset transition state after animation

So I've got this:

  animations: [
    trigger('shake', [transition('* => *', /* some animation */)])
  ]

And

<app-button
  [@shake]="shake"
>
</app-button>

When I click it, I set shake to true. When I click it again, I want the button to shake again but it doesn't because shake is already true.

How do I get around this?

New to Angular, thanks!

Upvotes: 5

Views: 2338

Answers (1)

Adam Jenkins
Adam Jenkins

Reputation: 55772

Figured it out by doing this:

<app-button
  [@shake]="shake"
  (@shake.done)="shake = false"
>
</app-button>

I'm going to leave this open because, like I said, I'm new to angular and doing this might be taboo, so if any expert wants to correct me, feel free!

Upvotes: 9

Related Questions