hashbang后AngularJS斜线获得EN codeD [英] AngularJS slash after hashbang gets encoded

查看:131
本文介绍了hashbang后AngularJS斜线获得EN codeD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经配置AngularJS locationProvider使用HTML5(以及回退在hashbangs)

I've configured AngularJS locationProvider to use html5 (and fallbacks in hashbangs)

$locationProvider.html5Mode(true).hashPrefix('!')

问题是,如果我访问例如的http://的locahost /#/ pathh /子路径角结束了重写浏览器显示的URL为的http://的locahost /#%2Fpath%2Fsubpath 。我使用的是Mac铬27。

The problem is that if I access for instance http://locahost/#!/pathh/subpath angular ends up rewriting the URL shown in the browser as http://locahost/#!%2Fpath%2Fsubpath. I'm using chrome 27 on mac.

谢谢!

推荐答案

这可能有助于<一个href=\"http://stackoverflow.com/questions/19741919/angular-slash-gets-en$c$cd\">angular-slash-gets-en$c$cd

我终于解决了它做两件事情:

I finally solved it doing two things:

1:我补充&LT;基本href =/&GT; 来的index.html
2:我激活HTML5模式,但没有preFIX

1.- I added <base href="/"> to index.html 2.- I activated HTML5 mode but without prefix

这样我可以使用的http://本地主机/#/路由的http://本地主机/路由和URL被正确重写。

This way I can use either http://localhost/#!/route or http://localhost/route and the URL gets rewritten correctly.

这篇关于hashbang后AngularJS斜线获得EN codeD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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