50

我知道可以通过 Github 页面托管基于 Jekyl 的静态站点/博客。可以对基于 AngularJS 的静态站点/博客做同样的事情吗?

4

4 回答 4

92

You can but you can't use html5 mode (removes the # from urls). If you use html5 mode, you have to redirect all requests to the root url since its a single page app. Since you can't use server side code on GitHub pages, you can't do this. So, if you don't mind the # in the url, go for it. If you want to use html5 mode, you need to look for hosting elsewhere.

From the Angular docs...

"Using [html5] mode requires URL rewriting on server side, basically you have to 
 rewrite all your links to entry point of your application (e.g. index.html)"

EDIT: You can make use of some clever hacks to make this work if you really want to. The hacks are outlined in detail here. In summary, you rename your index.html to 404.html and github will serve it at all routes

于 2013-06-21T18:45:09.420 回答
38

考虑到所有 Angular UI github 页面实际上都是带有演示的 Angular 应用程序,我会说是的:

http://angular-ui.github.io/

http://angular-ui.github.io/bootstrap/

ETC

于 2013-05-18T16:49:15.050 回答
12

Jekyll 和 Angular 之间存在一个需要注意的冲突。

包含在 Jekyll 中的 Liquid 也{{ }}用于计算表达式。要更改 Angular 解释的表达式(因此它不会与 Liquid 冲突),请使用:

var myapp;
myApp = angular.module('myApp', []);

myApp.config([
  '$interpolateProvider', function($interpolateProvider) {
    return $interpolateProvider.startSymbol('{(').endSymbol(')}');
  }
]);

看看这篇博文

于 2014-02-18T06:21:13.867 回答
1

是的你可以。我最近玩过 AngularJS/Typescript 和 github 页面,并且能够部署该站点。
由于 AngularJS 只是 javascript,您实际上可以使用任何体面的网络服务器,例如 github pages。这是演示你可以在这里
找到源代码。此存储库包含您必须编译的 typescript 源代码才能获得适当的 javascript 文件。然后你基本上把这个包含这个文件放到你的 index.html 中,你就完成了。

于 2018-05-01T15:50:02.073 回答