I am trying to fix an issue with routing getting confused by introducing regular expression to match my route parameters. The path needs to be something like:
/accounts/MER005
or
/accounts/MER0050000
so I came up with this expression [A-Z]{3}\d{3}?:\d{4}. But it doesn't work. There are no errors, but when I navigate to the URL, it doesn't do anything.
Just to clarify, this is my state:
$stateProvider.state('accounts', {
abstract: 'true',
url: "/accounts",
template: '<div ui-view></div>'
}).state('accounts.view', {
url: "/{accountNumber:[A-Z]{3}\d{3}?:\d{4}}",
views: {
'@': {
templateUrl: 'tpl/account/index.html',
controller: 'AccountController',
controllerAs: 'controller'
}
},
resolve: {
account: ['$stateParams', 'AccountService', function ($stateParams, accountService) {
return accountService.get($stateParams.accountNumber);
}]
},
data: {
requireLogin: true,
pageTitle: 'Account details'
}
})
Does anyone know how to get it to work properly?