0
我正在使用基于UI-Router-Extras(http://christopherthielen.github.io/ui-router-extras/#/future])未来状态机制的动态状态的AngularJS项目。AngularJs UI路由器FutureStates不与urlRouterProvider.otherwise
如果我使用urlRouterProvider.otherwise()
在应用程序配置阻止未来状态路由不工作了:除了下面的未来状态机制工作正常。
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")*/
任何提示如何应用$urlRouterProvider.otherwise("/error");
正确的方式或如何使用任何其他自动错误的路由机制(即自动路由到错误视图的情况下的状态或URL是不可用的)?
呀,不然的话目前没有工作。 https://github.com/christopherthielen/ui-router-extras/issues/39 – 2014-10-27 17:17:13
哦,你能为这种情况提出任何其他简单的解决方法吗? – Tom 2014-11-05 13:44:41
0.0.11将添加.otherwise支持。它应该很快发布。如果您今天需要,您可以从'master'构建ui-router-extras。 – 2014-11-05 18:21:52