I'm working on a AngularJS project which uses dynamic states based on the future state mechanism of UI-Router-Extras (http://christopherthielen.github.io/ui-router-extras/#/future]). The future state mechanism works fine except the following:
If I use urlRouterProvider.otherwise() in the application config block the future state routing doesn't work anymore.
app.config(['$futureStateProvider', '$controllerProvider', '$stateProvider', '$urlRouterProvider',
function($futureStateProvider, $controllerProvider, $stateProvider, $urlRouterProvider) {
$urlRouterProvider.when("", "/start");
$urlRouterProvider.when("/", "/start");
$urlRouterProvider.otherwise("/error"); /* !!! --> no route to future state possible anymore */
$stateProvider
.state('start', {
url: "/start",
templateUrl: "start.html",
controller: 'DemoMainCtrl'
})
.state('error', {
url: "/error",
templateUrl: "error.html"
})
... some more states ...
/* here comes the code for the futute state setup as in the example:
http://christopherthielen.github.io/ui-router-extras/example/future/index.html#/
whioch works fine as long as I'm not using $urlRouterProvider.otherwise("/error")*/
Any hints how to apply $urlRouterProvider.otherwise("/error"); the correct way or how to use any other automatic error routing mechanism (i.e. automatic route to an error view in case a state or URL is not available)?
masterif you need it today. - Chris T