angular - 为什么动画在 Angular 5 应用程序中不起作用?
问题描述
我正在尝试在 Angular 5 应用程序中开发第一个动画,但它不起作用。到目前为止我所做的详细说明:
- app.module.ts
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({
imports: [
BrowserModule,
...
BrowserAnimationsModule,
...
在我的组件中:
import { trigger,style,transition,animate,keyframes,query,stagger } from '@angular/animations';
animations: [
trigger('slideOut', [
transition('* => void', [
style({height: '*'}),
animate('2000ms ease-out', style({height: 0})),
])
])
]
这是模板:
<div [@slideOut] class="alert alert-success alert-dismissible fade in" role="alert">
<button type="button" class="close"><span aria-hidden="true">×</span></button>
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
All is good!
</div>
知道我在这里缺少什么吗?我需要安装一些东西吗?
解决方案
推荐阅读
- c# - C# BackgroundWorker.CancelAsync() 与 DoWorkEventArgs.Cancel
- python - Tkinter 创建两个窗口而不是一个
- python - PyCUDA 认为 53*53 == 2808
- c - 从最小值和最大值中查找 ID 号的问题
- python-imaging-library - 安装枕头:“无法找到包 libwebpmux3”
- php - php eval() 中的语句
- python - 连续运行 BeautifulSoup 网页抓取并显示标题的最新变化
- mysql - 我的 SQL 导入数据向导不创建架构
- css - 试图关闭背景颜色
- php - 如何从没有数组函数的数组中输出唯一值?