$urlRouterProvider.otherwise('/');与 Mean-seo 冲突
$urlRouterProvider.otherwise('/'); conflicting with Mean-seo
我正在尝试实施 Mean-seo,它似乎工作正常,但每次重定向到主页时除外。
http://localhost:3333/?_escaped_fragment_=/contact-us
闪烁联系我们页面,然后重定向到主页。
如果我删除
$urlRouterProvider.otherwise('/');
它显示联系我们页面,但主页只是空白。
这似乎解决了我的问题。使用这个
$urlRouterProvider.otherwise(function ($injector, $location) {
//what this function returns will be set as the $location.url
var path = $location.absUrl();
if (path.indexOf('_escaped_fragment_') === -1) {
//instead of returning a new url string, I'll just change the $location.path directly so I don't have to worry about constructing a new url string and so a new state change is not triggered
return '/';
}
// because we've returned nothing, no state change occurs
});
而不是
$urlRouterProvider.otherwise('/');
我正在尝试实施 Mean-seo,它似乎工作正常,但每次重定向到主页时除外。
http://localhost:3333/?_escaped_fragment_=/contact-us 闪烁联系我们页面,然后重定向到主页。
如果我删除
$urlRouterProvider.otherwise('/');
它显示联系我们页面,但主页只是空白。
这似乎解决了我的问题。使用这个
$urlRouterProvider.otherwise(function ($injector, $location) {
//what this function returns will be set as the $location.url
var path = $location.absUrl();
if (path.indexOf('_escaped_fragment_') === -1) {
//instead of returning a new url string, I'll just change the $location.path directly so I don't have to worry about constructing a new url string and so a new state change is not triggered
return '/';
}
// because we've returned nothing, no state change occurs
});
而不是
$urlRouterProvider.otherwise('/');