【问题标题】:ngx-wow not working angular 5ngx-wow 不工作 Angular 5
【发布时间】:2018-04-06 10:29:19
【问题描述】:

我之前从未使用过这个库,希望有人可以帮助我,

好的,所以我正在尝试使用 ngx-wow 库,但我无法让它工作.. 所以请按照说明进行操作

我跑了yarn add wowjs

我添加到angular-cli.json

"scripts": [
   "../node_modules/wowjs/dist/wow.js"
]

我还以同样的方式将animate.css 添加为全局依赖项

"styles": [
   "../node_modules/animated.css/animate.css"
]

然后我按照这样的说明安装ngx-wow..

`yarn add ngx-wow`

然后在我的主模块中我导入了ngwWowModule

import { NgwWowModule } from 'ngx-wow';

@NgModule({
    declarations: [...],
    imports: [NgwWowModule.forRoot(), ...],
    bootstrap: [...]
})

然后在我要使用wow.js的组件中

import { NgwWowService } from 'ngx-wow';

...


constructor (
   private wowService: NgwWowService
)

ngOnInit() {
   this.wowService.init();
}

在我的组件 html 中

<div class="wow fadeIn"></div>

但我无法让它在我的控制台中运行我收到此错误...

我不确定我做错了什么,任何帮助将不胜感激!

【问题讨论】:

    标签: javascript angular typescript wow.js


    【解决方案1】:

    我没有发现任何重大问题,请尝试在 angular-cli.json

    中添加没有 min.js 的 main.js
    scripts": [
            "../node_modules/wowjs/dist/wow.min.js"
    ]
    

    并在构造函数下初始化

     constructor(private wowService: NgwWowService) {
        this.wowService.init();
      }
    

    和示例 HTML

     <h1 class="section-heading pt-4 wow fadeInUp" data-wow-delay="0.6s">Why is it so great?</h1>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-30
      • 1970-01-01
      • 2018-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多