Hi I've been studying angular 1.5 and using this course
大家好,我一直在学习角1。5,这门课
https://thinkster.io/angularjs-es6-tutorial
https://thinkster.io/angularjs-es6-tutorial
I've cloned the repo to help me get started and while following the video tutorial, I noticed that my address bar was looking something like this:
我克隆了repo来帮助我开始,在视频教程之后,我注意到我的地址栏是这样的:
http://localhost:4000 / # ! /
whereas the developer doing the tutorial had /#/ in his address bar.
而做教程的开发人员在他的地址栏中有/#/。
Why is this the case?
为什么会这样?
Also im getting these angular ui-router errors:
我还得到这些角度ui-路由器错误:
Error: transition superseded
Error: transition prevented
Error: transition aborted
Error: transition failed
错误:转换替代错误:转换阻止错误:转换中止错误:转换失败
Anyone have an idea?
有人有一个想法吗?
1 个解决方案
#1
2
The /#!/ is angular's $location service doing.
/ # !/是角的$location服务。
Before history.pushState https://developer.mozilla.org/en-US/docs/Web/API/History_API
之前的历史。pushState https://developer.mozilla.org/en-US/docs/Web/API/History_API
We (The web community) did a workaround where we tracked the window.location.hash most notably twitter.com. now a days http://caniuse.com/#feat=history is supported by all browsers.
我们(web社区)在跟踪windows .location时做了一个变通。散列最明显的是twitter.com。现在,http://caniuse.com/#feat=历史得到了所有浏览器的支持。
So I would suggest to enable html5Mode to use the new history API, which will remove the /#!/ https://docs.angularjs.org/guide/$location#hashbang-and-html5-modes
因此,我建议启用html5Mode来使用新的历史API,它将删除/#!/ https://docs.angularjs.org/guide/ $ # hashbang-and-html5-modes位置
#1
2
The /#!/ is angular's $location service doing.
/ # !/是角的$location服务。
Before history.pushState https://developer.mozilla.org/en-US/docs/Web/API/History_API
之前的历史。pushState https://developer.mozilla.org/en-US/docs/Web/API/History_API
We (The web community) did a workaround where we tracked the window.location.hash most notably twitter.com. now a days http://caniuse.com/#feat=history is supported by all browsers.
我们(web社区)在跟踪windows .location时做了一个变通。散列最明显的是twitter.com。现在,http://caniuse.com/#feat=历史得到了所有浏览器的支持。
So I would suggest to enable html5Mode to use the new history API, which will remove the /#!/ https://docs.angularjs.org/guide/$location#hashbang-and-html5-modes
因此,我建议启用html5Mode来使用新的历史API,它将删除/#!/ https://docs.angularjs.org/guide/ $ # hashbang-and-html5-modes位置