I'm using the angular-cli .net core starter. Now I'm adding my own css + javascript and getting following error:
An unhandled exception occurred while processing the request. Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Bootstrap's JavaScript requires jQuery
I already tried:
npm install jquery
+
import $ from 'jquery'; => in app component
How do you configure jquery with webpack / angular2 ?
Thanks!
安装类型定义:
npm install @types/jquery
steps
npm install jquery — save
Add "scripts": [ "../node_modules/jquery/dist/jquery.min.js" ]
to angular-cli.json file
Import it into the component : import * as $ from 'jquery';
Example:
$(document).ready(function(){ $("button").click(function(){ ... } });
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.