【发布时间】:2020-04-07 18:48:20
【问题描述】:
为什么我的退出动画“离开”不起作用? 进入动画效果很好但离开(退出)不起作用? 请检查我的代码并给我提示?
animations: [
trigger('bubbleGrow', [
transition(':enter', [
animate('1000ms ease-in-out', keyframes([
style({transform: 'scale(0.5)'}),
style({transform: 'scale(1)'}),
]))
]),
transition(':leave', [
animate('1000ms ease-in-out', keyframes([
style({transform: 'scale(1)'}),
style({transform: 'scale(1.1)'}),
style({transform: 'scale(0)'})
]))
]),
])
]
constructor(private modalService: NgbModal, private activeModal: NgbActiveModal){}
close() {
this.activeModal.close();
}
<div class="modal-body" [@bubbleGrow]>
Here is my code in modal....
<button type="button" class="close" (click)="close()" >
<span aria-hidden="true">×</span>
</button>
</div>
【问题讨论】:
-
问题是,您使用的是 ng 引导模式,该模式通过 Angular 渲染呈现,这就是触发“:enter”的原因,但通过引导逻辑将其删除。您的“:离开”触发器不会被触发,因为您的角度渲染生命周期不会将其注册为“离开”,因此不会发生动画。您可以通过关闭延迟“ngClass”和动画淡出动画来解决问题。
-
哎呀?怎么办?
-
我看到了,但是这样不会关闭对话框并设置两个对话框打开..
-
@Luxusproblem 我正在看这个,但我不知道有什么问题?动画淡入作品,但淡出无作品。我需要淡出..
标签: javascript css angular twitter-bootstrap