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