Reputation: 1518
I'm trying to add a third party library to angular2, namely the Flickity slider.
Tried to install typings. When importing them I get en error that @typings/flickity is not a module
.
Second attempt to add it in angular-cli.json
. Added in apps[0].scripts
as described in the docs.
In the component i've used it like this:
this.slider = new Flickity('.news-wrapper', { cellAlign: 'left', contain: true, prevNextButtons: false, pageDots: true });
When compiling I get an error Cannot find name 'Flickity'.
, but when running the site it works like a charm.
The problem is I can't build the app because of that error.
How should it be added then?
Upvotes: 1
Views: 796
Reputation: 4983
follow below steps to use flickity in angular-cli based project
use it like as you mentioned
this.slider = new Flickity('.news-wrapper', { cellAlign: 'left', contain: true, prevNextButtons: false, pageDots: true });
Upvotes: 3
Reputation: 628
I am not sure if this will work but you can try this in the file that needs flickity.
let Flickity = require('flickity');
Just make sure you installed let Flickity using NPM
Upvotes: 0