结合 AngularJS、HTML5 个位置和超静态
Combining AngularJS, HTML5 locations and superstatic
我一直在使用 nodejs http-server 来提供我的 Angular 应用程序,但它不能很好地用于 HTML5 位置,因为使用它们需要服务器重定向,而 http-server 不会那样做。于是看到推荐试试superstatic,就安装了。然后我设置了以下 superstatic.json 文件:
{
"routes": {
"Admin/**":"/index.html",
"Give/**":"/index.html",
"Pending/**":"/index.html",
"Store/**":"/index.html"
}
}
我用
启动了它
superstatic --config superstatic.json
虽然如果我从“/”开始它可以正确地为我的应用程序提供服务,但重新加载会加载 index.html 文件,但不会对文件进行任何 angular 处理。
有没有人成功地将 superstatic 与 angular 一起使用?
以下 superstatic.json 配置适用于 AngularJS 和 HTML5 模式。
{
"routes": [
{"**": "index.html"}
]
}
您不需要在配置中指定每个路线组合,除非您有特定的路线或州要求。
我通过像这样设置 superstatic.json
来完美地工作:
{
"rewrites": [
{"source":"/**","destination":"/index.html"}
]
}
然后 运行 它与
superstatic --config superstatic.json
我一直在使用 nodejs http-server 来提供我的 Angular 应用程序,但它不能很好地用于 HTML5 位置,因为使用它们需要服务器重定向,而 http-server 不会那样做。于是看到推荐试试superstatic,就安装了。然后我设置了以下 superstatic.json 文件:
{
"routes": {
"Admin/**":"/index.html",
"Give/**":"/index.html",
"Pending/**":"/index.html",
"Store/**":"/index.html"
}
}
我用
启动了它superstatic --config superstatic.json
虽然如果我从“/”开始它可以正确地为我的应用程序提供服务,但重新加载会加载 index.html 文件,但不会对文件进行任何 angular 处理。
有没有人成功地将 superstatic 与 angular 一起使用?
以下 superstatic.json 配置适用于 AngularJS 和 HTML5 模式。
{
"routes": [
{"**": "index.html"}
]
}
您不需要在配置中指定每个路线组合,除非您有特定的路线或州要求。
我通过像这样设置 superstatic.json
来完美地工作:
{
"rewrites": [
{"source":"/**","destination":"/index.html"}
]
}
然后 运行 它与
superstatic --config superstatic.json