AngularJS ui-router otherwise to state instead of url?

后端 未结 3 1639
傲寒
傲寒 2021-02-14 04:26

I am using AngularJS and ui-router and in my app.js. I have the following line:

$urlRouterProvider.otherwise(\'/\');

However

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-14 04:34

    I think you achieved that with this code

    $urlRouterProvider.otherwise(function($injector, $location){
      $injector.invoke(['$state', function($state) {
        $state.go('404');
      }]);
    }); 
    

提交回复
热议问题