Is it possible to set up a fallback route in angular routes? For instance, is there a way to specify a fallback route like this:
$routeProvider
.when('/a', {
templateUrl: 'a.html',
controller: 'aCtrl'
})
.when('/b', {
templateUrl: 'b.html',
controller: 'bCtrl',
resolve: {/* some resolving */},
fallbackRoute: 'a'
})
.when('/c', {
templateUrl: 'c.html',
controller: 'cCtrl'
})
.when('/d', {
templateUrl: 'd.html',
controller: 'dCtrl',
resolve: {/* some resolving */},
fallbackRoute: 'c'
})
In the above example, if the '/b' route cannot be resolved, it will fall back to the '/a' route.
Is there a common pattern or method for achieving this behavior? Using otherwise
won't work in my case since 'a' and 'c' are distinct routes.
Thanks