我想要显示404错误页面,但我也想保存错误的网址在位置。
如果我这样做的话:
$urlRouterProvider.otherwise('404');
$stateProvider
.state('404', {
url: '/404',
template: error404Template
});
url将更改为/404
。如何在不更改实际url的情况下在错误的url上显示错误消息?
发布于 2015-08-29 04:03:48
从ui-router#0.2.15
开始,您可以使用$state.go()
和send选项不更新位置:
$urlRouterProvider.otherwise(function($injector) {
var $state = $injector.get('$state');
$state.go('404', null, {
location: false
});
});
https://stackoverflow.com/questions/23298021
复制相似问题