angular-cli和bootstrap 4
发布时间:2020-12-17 07:32:53 所属栏目:安全 来源:网络整理
导读:我用angular 2移动我的第一步,特别是我使用angular-cli官方工具来创建新项目. 我以这种方式创建了一个新项目 ng new [my-project-name] 该项目已正确创建. 之后我想安装bootstrap 4,然后按照angular-cli页面中的官方指南进行操作. 我用npm安装bootstrap: np
我用angular 2移动我的第一步,特别是我使用angular-cli官方工具来创建新项目.
我以这种方式创建了一个新项目 ng new [my-project-name] 该项目已正确创建. 之后我想安装bootstrap 4,然后按照angular-cli页面中的官方指南进行操作. 我用npm安装bootstrap: 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" ], 在app对象中. 当我构建应用程序并在服务器中使用:ng serve运行它 我没有在index.html中找到bootstrap css和javascript的参考. 我不明白是否在我的index.html中自动添加了此文件的导入,或者我需要手动添加它.
将脚本和样式条目添加到angular.cli.json文件时,它们将添加到全局范围.具体来说,它们被添加到scripts.bundle.js和styles.bundle.js中.没有必要将它们添加到index.html.停止并重新启动服务后,您应该好好去.为了更好的衡量,我在更改angular.cli.json后运行npm rebuild.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |