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

前端 未结 9 704
忘掉有多难
忘掉有多难 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:42

    Add angular-ui-router-default and add the abstract and default options to the parent state:

    ...

    .state('manager.staffDetail.view', {abstract: true, default: '.schedule', url:'/view',  templateUrl: 'views/staff.details.html', data:{activeMenu: 'staff'}})
      .state('manager.staffDetail.view.schedule', {url:'/schedule', templateUrl:'views/staff.view.schedule.html', data:{activeMenu: 'staff'}})
    

    ...

    Note: for this to work, the parent template must have somewhere in it.

提交回复
热议问题