jquery - 如何在不使用 Angular CLI 的情况下在索引页中添加 bootstrap 和 JQuery 引用

标签 jquery twitter-bootstrap angular visual-studio

我在我的应用程序中使用 VS2015 和 Angular 2。从 Angular 快速启动解决方案创建应用程序,为了使用 bootstrap css,我从 nuget 下载了 bootstrap 和 jquery 库。我通过从内容和脚本文件夹中拖动文件来添加这些引用。

<link href="../Content/bootstrap.css" rel="stylesheet" />
<script src="../scripts/jquery-3.2.1.min.js"></script>
<script src="../scripts/bootstrap.min.js"></script>

运行应用程序时显示以下错误

http://localhost:2123/Content/bootstrap.css net::ERR_ABORTED http://localhost:2123/scripts/jquery-3.2.1.min.js net::ERR_ABORTED http://localhost:2123/scripts/bootstrap.min.js 404 (Not Found)

我尝试了以下

href="~/Content/ , href="./Content/ ,  href="Content/ Etc.

但仍然没有加载。如何将这些文件添加到索引页中?我是 angular2 的新手,请建议我一种解决方案。

最佳答案

您可以将所需的文件放置在解决方案的ASSETS文件夹中。添加这些文件后,您必须将这些文件的引用添加到 angular.cli.json 文件中。

欲了解更多详情,请参阅以下快照。

enter image description here

关于jquery - 如何在不使用 Angular CLI 的情况下在索引页中添加 bootstrap 和 JQuery 引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47794427/

相关文章:

javascript - 捕获/处理 502 错误网关错误

javascript - javascript如何上传blob?

jquery - 我图像中的信息窗口对话框气球

Javascript 阻止表单提交

javascript - 如何识别图片id标签不是静态的点击图片?

css - 如何使 Bootstrap 导航中的跨度具有宽度 : 0px?

javascript - 在单击 Bootstrap 选项卡之前,Jquery 无法隐藏和显示 div

angular - 在 angular 6 网站中删除 PWA 后,如何从客户端浏览器中删除 PWA Service Worker 及其缓存

Angular CLI 6 - 使用 Source Maps 构建 Angular 库

angular - 下拉模块在 ngx-bootstrap 中不可用