我正在尝试处理找不到Angular ui-router的页面和"否则"。
当我点击标记的锚链接时,我有下一个错误:
Error: Could not resolve '/erro' from state 'errorpage'
at Object.transitionTo (angular-ui-router.js:3248)
at Object.go (angular-ui-router.js:3176)
at angular-ui-router.js:4267
at angular.js:19916
at completeOutstandingRequest (angular.js:6111)
at angular.js:6390
这是我的代码:
标记:
<li><a ui-sref='/erro'>DashBoard</a></li>
<li><a ui-sref='/erro'>Caixa</a></li>
angular app.js:
app.config(function($stateProvider, $urlRouterProvider,$locationProvider) {
$urlRouterProvider.otherwise(function ($injector, $location) {
var $state = $injector.get('$state');
$state.go('errorpage', {
title: "Page not found",
message: 'Could not find a state associated with url "'+$location.$$url+'"'
});
});
$stateProvider
.state('errorpage',{
url: "*path",
template:'<div>{{title}}-{{message}}</div>'
})
.........
continues