结合AngularJS,HTML5位置和超静态 [英] Combining AngularJS, HTML5 locations and superstatic

查看:78
本文介绍了结合AngularJS,HTML5位置和超静态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用nodejs http服务器来提供我的Angular应用程序,但是它不适用于HTML5位置,因为使用它们需要服务器重定向,而http服务器却不能这样做.因此,我看到了推荐使用超静态的建议,并进行了安装.然后,我设置了以下superstatic.json文件:

I've been using the nodejs http-server to serve up my Angular app, but it doesn't work well with HTML5 locations, because using them requires the server to redirect, and http-server doesn't do that. So I saw a recommendation to try superstatic, and installed it. Then I set up the following superstatic.json file:

{
  "routes": {
    "Admin/**":"/index.html",
    "Give/**":"/index.html",
    "Pending/**":"/index.html",
    "Store/**":"/index.html"
  }
}

我用

superstatic --config superstatic.json

如果我从"/"开始,它可以正常运行我的应用程序,则重新加载index.html文件,但不对文件进行任何角度处理.

While it correctly serves up my app if I start at "/", reloads load the index.html file, but do not do any of the angular processing of the file.

有没有人成功地将超静角与角配合使用?

Has anyone successfully used superstatic with angular?

推荐答案

我将我的superstatic.json设置为这样,使我的工作非常完美:

I got mine perfectly working by setting my superstatic.json like this:

{
  "rewrites": [
    {"source":"/**","destination":"/index.html"}
  ]
}

然后使用

superstatic --config superstatic.json

这篇关于结合AngularJS,HTML5位置和超静态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆