【问题标题】:How to use 'css-animator' in Ionic 3?如何在 Ionic 3 中使用“css-animator”?
【发布时间】:2018-07-15 21:03:06
【问题描述】:

我已经通过 npm 将“css-animator”安装到我的项目中

npm install css-animator --save

我还在 index.html 页面中添加了以下行

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">

现在,当我尝试在应用模块中导入 AnimationService 或 AnimatesDirective 时,通过

import { AnimationService, AnimatesDirective } from 'css-animator';

但我收到错误提示找不到“css-animator”模块。

我正在按照此链接https://devdactic.com/animations-ionic-app/中提到的步骤进行操作

【问题讨论】:

    标签: ionic-framework css-animations ionic3


    【解决方案1】:

    将以下代码添加到 app.module.ts 声明和提供程序部分:

    import { AnimationService, AnimatesDirective } from 'css-animator';
    ...
    ...
     declarations: [
        ...
        AnimatesDirective
     ]
     providers: [
        StatusBar,
        SplashScreen,
        {provide: ErrorHandler, useClass: IonicErrorHandler},
        AnimationService
      ]
    

    【讨论】:

      猜你喜欢
      • 2018-11-22
      • 2018-03-31
      • 2019-12-10
      • 2018-11-10
      • 2018-01-15
      • 1970-01-01
      • 2018-02-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多