I have both routes leading to the same view and controller (i.e. I just pass the identifier for access to $ routeParams and executing the controller logic on it):
$routeProvider
.when('/about',
{
controller: 'AboutController',
controllerAs: 'vm',
templateUrl: 'about.html'
})
.when('/about/:id',
{
controller: 'AboutController',
controllerAs: 'vm',
templateUrl: 'about.html'
});
It seems very repetitive. Is there a shorthand, something like this?
$routeProvider
.when(['/about', '/about/:id'],
{
controller: 'AboutController',
controllerAs: 'vm',
templateUrl: 'about.html'
})
source
share