【问题标题】:Angular 2 - Failed to load resource: the server responded with a status of 404 (Not Found)Angular 2 - 加载资源失败:服务器响应状态为 404(未找到)
【发布时间】:2017-11-02 08:39:24
【问题描述】:

在 index.html 文件中,我导入了一个文件配置: <script src="http://localhost:4200/src/config.js"></script> 文件 config.js 它与 index.html 位于同一文件夹中,但是当我午餐项目时,它在控制台上给了我这个错误: 加载资源失败:服务器响应状态为 404(未找到)

【问题讨论】:

    标签: angular


    【解决方案1】:

    您无需在 src 中提及 localhost。

    <script src="./config.js"></script>
    

    【讨论】:

      猜你喜欢
      • 2023-04-01
      • 2018-09-07
      • 2017-03-12
      • 2015-12-01
      • 2018-08-09
      相关资源
      最近更新 更多