我是 angular-cli 的新手。我想安装 npm 库 mdbootstrap。我按照这里的说明进行操作:Angular CLI 说明 https://github.com/angular/angular-cli#global-library-installation
具体来说,我是这样做的:
- 我通过安装 mdbootstrap
npm install bootstrap
.
- 我添加了所有文件
dist
目录到我的angular-cli.json
.
angular-cli.json
补充:
"styles": [
"../node_modules/mdbootstrap/css/bootstrap.min.css",
"../node_modules/mdbootstrap/css/mdb.min.css",
"../node_modules/mdbootstrap/css/style.css"
],
"scripts": [
"/node_modules/mdbootstrap/dist/js/bootstrap.min.js",
"/node_modules/mdbootstrap/dist/js/jquery-3.1.1.min.js",
"/node_modules/mdbootstrap/dist/js/mdb.min.js",
"/node_modules/mdbootstrap/dist/js/tether.min.js",
],
我的问题:我是否还必须通过脚本包含所有这些文件<link>
and <script>
标签,到index.html
基础文件?
EDIT
在以正确的方式进行操作之前,我只是以旧的方式安装了我的库,直接注入到index.html中。
按照上述说明操作后,我确实在 index.html 的源代码中看到了额外的插入。所以,这是有希望的。
但是,当我删除所有原始内容和手动放入index.html 文件中的标签时,一切都会崩溃。我尝试在 Chrome 调试控制台中进行 jquery 选择,但失败了。我尝试在 angular-cli 捆绑文件中搜索第三方函数。就好像 ngserve 命令没有安装任何东西一样。