简体   繁体   English

破坏角度1.5.9 $ location.hashPrefix的变化

[英]breaking change in angular 1.5.9 $location.hashPrefix

It looks like the default $location.hashPrefix was "" (empty string) until 1.5.8 , however, it was changed to "!" 看起来默认的$location.hashPrefix是“”(空字符串),直到1.5.8 ,然而,它被更改为“!” in 1.5.9 . 1.5.9 Unfortunately, my code has a lot of places like <a ng-ref="/Customer#/{{customerId}}> that is now breaking. Is there a global way to handle this? Or the only way is to go through the whole codebase in preparation for 1.5.9? FWIW, I am curious what was the rationale for this - can't find a discussion anywhere... 不幸的是,我的代码有很多地方,如<a ng-ref="/Customer#/{{customerId}}>现在正在破坏。有没有全球性的方法来处理这个?或者唯一的方法是通过整个代码库准备1.5.9?FWIW,我很好奇这是什么原因 - 无法在任何地方找到讨论......

You are correct that the default hasPrefix changed from "" to "!" 你是正确的,默认的hasPrefix从""改为"!" .

If you set your hasPrefix to an empty string like $locationProvider.hashPrefix(''); 如果将hasPrefix设置为空字符串,如$locationProvider.hashPrefix(''); routes like /Customer/#/{{customerId}} that worked in 1.5.8 would work start resolving again in 1.5.9, from the testing that I have done, though they it will still render like /Customer/#!/1 在1.5.8中工作的/Customer/#/{{customerId}}类的路由可以从我已经完成的测试开始在1.5.9中再次开始解析,尽管它们仍然会像/Customer/#!/1那样渲染

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM