【问题标题】:AngularJS App not working on github pagesAngularJS 应用程序无法在 github 页面上运行
【发布时间】:2015-12-15 02:19:58
【问题描述】:

这就是仓库

https://github.com/fredericojesus/mygroceries-angular

这是github页面的链接

http://fredericojesus.github.io/mygroceries-angular/

由于某种原因,浏览器没有获取文件(见控制台),但它们确实存在,所以真的不知道发生了什么,我是 github 页面的新手,第一次尝试。 谁能帮忙?

【问题讨论】:

  • 问候,据我所知,github.io 只提供静态文件。因此不会获取加载外部资源(包括同一域中的资源)。如果您可以将包含文件中的内容复制粘贴到您的 index.html 中,它将正常工作。

标签: javascript angularjs github github-pages


【解决方案1】:

只需删除index.html 中的<base href="/">。然后将文件夹名称添加到libraries路径。

例如

<link rel="stylesheet" href="styles/lib-25ab91c4a2.css">
<link rel="stylesheet" href="styles/app-2b5253690c.css">

<script src="js/lib-05ac045750.js"></script>
<script src="js/app-d3af5f3ca4.js"></script>

希望这会有所帮助。

【讨论】:

  • 你需要添加你的libraries' directory的正确路径(js和css)。我会更新我的答案。
  • 是的,我发现这是错误的,因为我试图将所有文件都放在同一个文件夹中,但我又做对了,但仍然无法正常工作:S
  • 对不起,它的工作,我不得不再次删除基本的href hehe tks老兄!很多! :D
【解决方案2】:

如果没有以下答案帮助我,我也面临同样的问题。去掉这个元标记使 github 页面正常工作。

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-25
    • 2017-07-27
    • 2020-01-15
    • 2018-03-17
    • 2021-12-06
    • 2020-12-12
    • 2019-03-10
    相关资源
    最近更新 更多