当重定向到新页面时,window.location.assign()和之间有什么区别window.location.replace()?
在AngularJS路由文件中,有一个otherwise路由选项,替换404:
$routeProvider
.when(...)
.otherwise({
    redirectTo: 'my/path'
});
有没有办法做到这一点,否则重定向到不在应用程序中的页面?我试过了
$routeProvider
.when(...)
.otherwise({
    redirectTo: 'http://example.com'
});
但是这个jsut试图重定向到我的应用程序中的那条路径,这条路径不存在.我所知道的解决方案是$scope.$on('$routeChangeStart')在顶级控制器中进行手动重定向,但这是很多代码重复(而且很难看).有没有更好的办法?