I have incorporated jQuery into my Angular 6 project using the following steps:
npm install jquery
npm install --save @types/jquery
In addition, I have included jQuery in my angular.json file like this:
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js",
"src/assets/js/plugins.js"
The plugins.js file contains custom jQuery functions. However, when attempting to use one of these functions in my header.component.ts file, I encountered the following error:
ERROR in src/app/includes/header/header.component.ts(31,9): error TS2339: Property 'scrollUp' does not exist on type 'JQueryStatic'.
My header.component.ts file is structured as follows:
import * as $ from "jquery";
declare const meanmenu: any;
declare const scrollUp: any;
ngOnInit() {
$.scrollUp({
scrollText: '<i class="fa fa-angle-up"></i>',
easingType: 'linear',
scrollSpeed: 900,
animation: 'slide'
});
}