Otherwise For States With Typed Parameters
I started using typed parameters (such as {id:int}) in my route configuration. If a state doesn't match because of the type, otherwise does not appear to trigger. For example: $sta
Solution 1:
I'd say, that the concept as you wanted, is working. There is a working example
this state def (1:1 to question)
$stateProvider
.state('stuff', {
url: '/version/{version:int}/stuff',
templateUrl: 'tpl.html',
controller: 'StuffCtrl',
})
.state('list', {
url: '/list',
templateUrl: 'tpl.html',
controller: 'ListCtrl',
});
$urlRouterProvider.otherwise('/list');
will properly handle these links:
// list
<ahref="#/list">
// ui-sref
<aui-sref="stuff({version:1})"><aui-sref="stuff({version:2})">
// href
<ahref="#/version/12/stuff">
these will not work (as expected) - so they will not created any href (such state with such params does not exist)
<aui-sref="stuff({version:'A'})"><aui-sref="stuff({version:'xyz'})">
these href
will be redirect to otherwise
<ahref="#/version/x/stuff"><ahref="#/version/AB/stuff">
Check it in action here
Post a Comment for "Otherwise For States With Typed Parameters"