Otherwise on StateProvider

前端 未结 6 1716
粉色の甜心
粉色の甜心 2020-11-27 14:35

Using angular-ui-router, How can I use the otherwise method on $stateProvider or how can I use it at all ?

6条回答
  •  伪装坚强ぢ
    2020-11-27 14:52

    You can't use only $stateProvider.

    You need to inject $urlRouterProvider and create a code similar to:

    $urlRouterProvider.otherwise('/otherwise');
    

    The /otherwise url must be defined on a state as usual:

     $stateProvider
        .state("otherwise", { url : '/otherwise'...})
    

    See this link where ksperling explains

提交回复
热议问题