Angular引用jquery,bootstrap
1.Angular中引用jquery
安装:
npm install --save jquery
在app.component.ts中引用jquery
import * as $ from 'jquery';
引入jquery类型
cnpm install @types/jquery --save-dev
1.Angular中引用bootstrap
npm install --save bootstrap
angular-cli.json中进行配置bootstrap.min.css和bootstrap.min.js
"styles": [ "styles.css", "../node_modules/bootstrap/dist/css/bootstrap.min.css" ], "scripts": [ "../node_modules/bootstrap/dist/js/bootstrap.min.js" ]
我试了上面那种,发现并不会引用bootstrap.min.css和bootstrap.min.js
最后在index.html中引用
然后就可以了
我也不知道为啥~~