小编vin*_*raj的帖子

在页面加载时出错,提供的动画触发器“animate”尚未注册

我刚刚将我的 Web 应用程序项目从 angular 4 更新到了 angular 7,我在页面加载时遇到了动画触发器问题(ngOnInIt 方法)。我需要支持在 angular 4 和 angular 7 中流行的动画效果

我已将触发器添加到我的 app.module.ts 但我仍然无法解决错误

角 4

import {animateFactory } from 'ack-angular-fx'
Run Code Online (Sandbox Code Playgroud)

.ts 文件

@Component({
   selector: 'abc',
   templateUrl: './abc.component.html',
   styleUrls: ['./abc.component.css'],
   animations: [animateFactory(480, 200, 'ease-in', 100, 'animate')]
})
Run Code Online (Sandbox Code Playgroud)

.html 文件

<div [@animate]="'zoomIn'">
</div>
Run Code Online (Sandbox Code Playgroud)

角 7

.ts

import { trigger, transition, useAnimation } from '@angular/animations';
import { bounce, zoomIn } from 'ngx-animate';

@component({
  animations: [
        trigger('bounce', [transition('* => *', useAnimation(zoomIn))])
    ],
})
Run Code Online (Sandbox Code Playgroud)

.html

<div [@animate]="'zoomIn'"></div>
Run Code Online (Sandbox Code Playgroud)

我得到的实际错误消息是

Error: The …
Run Code Online (Sandbox Code Playgroud)

animation typescript angular angular7

4
推荐指数
1
解决办法
888
查看次数

标签 统计

angular ×1

angular7 ×1

animation ×1

typescript ×1