首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Angular6中使用引导带的本地副本时出错

在Angular6中使用引导带的本地副本时出错
EN

Stack Overflow用户
提问于 2018-09-15 13:20:51
回答 1查看 52关注 0票数 0

在我的项目中,我下载了本地副本 of BootstrapJqueryPopper。但是,当我将它们包含在Angular6项目中时,我会遇到错误。

文件在angular-test\src\assets\common的位置

我已经在Angular.jsonprojects属性下包含了它们的路径。

代码语言:javascript
复制
 "projects": {
    "angular-test": 
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css",
              "src/assets/common/css/vendor/bootstrap/bootstrap.css"
            ],
            "scripts": [
              "src/assets/common/javascripts/vendor/jquery/jquery-3.2.1.js",
              "src/assets/common/javascripts/vendor/popper/umd/popper.js",
              "src/assets/common/javascripts/vendor/bootstrap/bootstrap.js"
              ]
          },

并在index.html中使用如下所示:

代码语言:javascript
复制
<head>
...
 <link rel="stylesheet" media="screen" href="bootstrap.css">
</head>
<body>
  <app-root signup="success1"></app-root>

    <script src="jquery-3.2.1.js" type="text/javascript"></script>
    <script src="popper.js" type="text/javascript"></script>
    <script src="bootstrap.js")" type="text/javascript"></script>
</body>

我所犯的错误是

代码语言:javascript
复制
Refused to apply style from 'http://localhost:4200/bootstrap.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
jquery-3.2.1.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
localhost/:1 Refused to execute script from 'http://localhost:4200/jquery-3.2.1.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
popper.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
localhost/:1 Refused to execute script from 'http://localhost:4200/popper.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
bootstrap.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
localhost/:1 Refused to execute script from 'http://localhost:4200/bootstrap.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-09-17 13:51:43

问题是,由于我已经在scripts属性中指定了Angular.json中的javascripts,所以不需要在index.html中显式添加它们。我评论了下面几句,它起了作用

代码语言:javascript
复制
<!--script src="jquery-3.2.1.js" type="text/javascript"></script>
    <script src="popper.js" type="text/javascript"></script>
    <script src="bootstrap.js" type="text/javascript"></script-->
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52345079

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档