【发布时间】:2020-10-10 04:40:37
【问题描述】:
我有两个元素使用相同的动画animate
一个元素使用触发器(@animate.done) 来执行一些逻辑后期动画。
我的问题是,如果我单击另一个元素,也会调用 donecallback:
<button [@animate]="open === 'open' ? 'open': 'closed'" (click)="toggle()">one</button> <--- If I click this
<br>
<br>
<button [@animate]="open === 'open'? 'open': 'closed'" (@animate.done)="counter()" (click)="toggle()">two: animation.done called: {{count}} </button> <-- then this counter goes up
我这里做了一个例子:https://stackblitz.com/edit/angular-ivy-mukyz4?file=src/app/app.component.html
有没有办法将回调隔离到使用它的元素?
【问题讨论】:
标签: html angular angular-animations