【发布时间】:2016-09-12 07:21:27
【问题描述】:
我用 angular 2 移动了我的第一步,特别是我使用 angular-cli 官方工具来创建新项目。
我就这样新建了一个项目
ng new [my-project-name]
项目已正确创建。
之后我想安装 bootstrap 4,并按照 angular-cli 页面中的官方指南进行操作。
我用 npm 安装引导程序:
npm install bootstrap@next
然后我在 angular-cli.json 中添加该行:
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/tether/dist/js/tether.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.css"
],
在应用对象中。
当我构建应用程序并在服务器中运行它时:ng serve
我在 index.html 中找不到引导 css 和 javascript 的参考。
我不明白这个文件的导入是自动添加到我的 index.html 中还是我需要手动添加。
【问题讨论】:
-
您可以使用提供正确集成 Angular 2 和 Bootstrap 4 的项目:ng-bootstrap.github.io
标签: angular angular-cli bootstrap-4