I want to use titl.js in my Angular 5
app. Here is what I did so far:
npm install jquery --save
npm install tilt.js --save
And then in my .angular-cli.json
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/tilt.js/dest/tilt.jquery.min.js"
]
In the component which uses tilt.js
I have:
declare var jQuery: any;
And
@ViewChild( 'LoginTitl' ) login_titl: ElementRef;
ngAfterViewInit() {
jQuery( this.login_titl.nativeElement ).tilt( {
scale: 1.1
} );
}
But I get the following error:
Property 'tilt' does not exist on type 'JQuery<any>'.
Just working now. I don't know if this is the solution or not, but adding the following line made the code work.
import 'tilt.js';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.