hashbang编码后的AngularJS斜杠
我已经将AngularJS locationProvider配置为使用html5(以及hashbangs中的回退) 问题是,如果我访问例如hashbang编码后的AngularJS斜杠,angularjs,Angularjs,我已经将AngularJS locationProvider配置为使用html5(以及hashbangs中的回退) 问题是,如果我访问例如http://locahost/#!/路径/子路径angular最终会将浏览器中显示的URL重写为http://locahost/#!%2路径%2子路径。我在mac上使用chrome 27 谢谢 这可能有助于: 我通过做两件事解决了这个问题: 我在index.html中添加了 我激活了HTML5模式,但没有前缀 这样我可以使用http://localhost/
http://locahost/#!/路径/子路径
angular最终会将浏览器中显示的URL重写为http://locahost/#!%2路径%2子路径
。我在mac上使用chrome 27
谢谢 这可能有助于:
我通过做两件事解决了这个问题:
这样我可以使用
http://localhost/#!/路线
或http://localhost/route
并且URL被正确重写。有什么问题?路由是否工作不正常?缺少步骤3,即您的
标记不应再是href=“#/route”
,而是href=“route”
$locationProvider.html5Mode(true).hashPrefix('!')