angularjs ui-router default child state and ui-sref

后端 未结 2 1068
天命终不由人
天命终不由人 2020-12-14 03:17

I have the following states in my ui-router state provider:

$urlRouterProvider.when(\'/parent\', \'/parent/child\');
$stateProvider.state(\'parent\', {
              


        
2条回答
  •  我在风中等你
    2020-12-14 03:59

    If you want to use $state's convenient naming structure for abstract states, you can use this in a service:

    $location.path(
        $state.href('app.some.abstract.state', { some: 'params' })
    );
    

    Or this in a template ($state must be available in the local or global $scope):

    ...
    

    If I found myself doing this regularly, I would create a directive similar to ui-sref for this, minus the abstract state limitation.

提交回复
热议问题