1

I've never used this library before Im hoping someone who has can help me out,

Okay So I'm trying to use the ngx-wow library but I cant get it to work.. so following the instructions

Ive run yarn add wowjs

I added it to angular-cli.json

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

I also added animate.css as a global dependency the same way

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

then I install ngx-wow following the instructions like so..

`yarn add ngx-wow`

then in my main module Ive imported the ngwWowModule

import { NgwWowModule } from 'ngx-wow';

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

then In the component I want to use wow.js

import { NgwWowService } from 'ngx-wow';

...


constructor (
   private wowService: NgwWowService
)

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

and in my components html

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

but I cant get it to work in my console Im getting this error...

enter image description here

Im not sure what Im doing wrong any help would be appreciated!

4

1 回答 1

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>
于 2018-04-06T02:11:21.887 回答