直接来自https://angular.io/docs/ts/latest/guide/forms.html https://angular.io/docs/ts/latest/guide/forms.html
让我们添加样式表。
在应用程序根文件夹中打开终端窗口并输入命令:
npm 安装引导程序 --save
打开index.html并将以下链接添加到头部。
链接 rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
但是,我不断收到 404
GET http://localhost:4200/node_modules/bootstrap/dist/css/bootstrap.min.css http://localhost:4200/node_modules/bootstrap/dist/css/bootstrap.min.css
当我使用在线地址添加脚本时它可以工作,但为什么 Angular 无法找到我的文件的路径?
如果您正在使用角度-cli,你可以去root/styles.css
并添加这一行
@import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
或者去.angular-cli.json
并修改styles
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)