aspnetcore-angular-universal
aspnetcore-angular-universal copied to clipboard
JQuery plug ins not working
I have followed the instructions for adding Jquery and its plug ins.
- Added
'jexcel/dist/js/jquery.jexcel', 'jquery'
to vendor nonTreeShakableModules - Uncommented the JQuery ProvidePlugin plug in
- Added import
'jexcel/dist/js/jquery.jexcel';
to boot browser file - Added
import * as $ from "jquery";
to the component file - Added
$("#mytable").jexcel({});
to component file
I am seeing the following error
__WEBPACK_IMPORTED_MODULE_0_jquery__(...).jexcel is not a function
Additional information:
- I currently have pre rendering turned off
- I am using Jquery 3.3
Am i missing something? Thanks
It seems you are missing the TypeScript instructions. Make sure you add jquery to tsconfig.json and then create the interface in typings.d.ts. This is so typescript knows how to call and use the javascript. This article should help https://medium.com/all-is-web/angular-5-using-jquery-plugins-5edf4e642969