Otherwise on StateProvider

前端 未结 6 1721
粉色の甜心
粉色の甜心 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 15:05

    I just want to chime in on the great answers that are already provided. The latest version of @uirouter/angularjs marked the class UrlRouterProvider as deprecated. They now recommend using UrlService instead. You can achieve the same result with the following modification:

    $urlService.rules.otherwise('/defaultState');
    

    Additional methods: https://ui-router.github.io/ng1/docs/1.0.16/interfaces/url.urlrulesapi.html

提交回复
热议问题