Directing the user to a child state when they are transitioning to its parent state using UI-Router

前端 未结 9 707
忘掉有多难
忘掉有多难 2020-11-30 19:06

Consider the following:

.state(\'manager.staffList\', {url:\'^/staff?alpha\', templateUrl: \'views/staff.list.html\', data:{activeMenu: \'staff\'}, controlle         


        
9条回答
  •  醉话见心
    2020-11-30 19:33

    Quite late but I think you can "redirect" to the state you want.

    .state('manager.staffDetail.view', {
        url:'/view',
        templateUrl: 'views/staff.details.html',
        controller: 'YourController'
    })
    
    app.controller('YourController', ['$state',
    function($state) {
        $state.go('manager.staffDetail.view.schedule');
    }]);
    

    You can write you controller right in the state config for short.

提交回复
热议问题