【问题标题】:html5 $locationProvider work fine on grunt serve but not working in grunt buildhtml5 $locationProvider 在 grunt serve 上工作正常,但在 grunt build 上不工作
【发布时间】:2016-08-06 13:02:39
【问题描述】:

当我使用grunt 运行serve 时,$locationProvider.html5Mode(true) 工作正常。 但不适用于grunt build 并在console 中显示错误unexpected syntax error <

【问题讨论】:

  • 该错误可能意味着您正在从服务器请求 json 或 javascript 但正在返回一个 html 页面,这通常发生在打开 html5 模式并且您的 Web 服务器将所有 404 重定向到索引时.这可能是有道理的,因为在grunt serve 上,重定向到索引可能已打开,但无论您将其托管在什么位置,它都已打开。不幸的是,除非您向我们展示您的 Gruntfile,否则我们无法判断 grunt serve 的作用。
  • @DanPantry: 谢谢你,我会检查一下是否可能
  • No.It's not working here is my grunt file。 jsfiddle.net/saqibrizwan/70wx2mfo
  • @DanPantry:检查我在此链接上上传的 grunt 文件jsfiddle.net/saqibrizwan/70wx2mfo

标签: angularjs gruntjs angular-ui-router yeoman-generator


【解决方案1】:

如果你在像 www.test.com/test 这样的子域名上部署,那么你必须在基本标签上提及 /test

就是这样!

【讨论】:

    猜你喜欢
    • 2015-09-18
    • 1970-01-01
    • 2015-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-06
    相关资源
    最近更新 更多