使用LoadChildren进行Angular 2路由

时间:2017-02-16 12:20:44

标签: angular typescript angular-routing

我正在使用此代码进行路由

/dashboard

当网址为/dashboard/first...时,我需要将其路由到<ion-input type="number" [(ngModel)]="value"></ion-input> {{value}}

我怎样才能实现它?

1 个答案:

答案 0 :(得分:5)

您已经在Dashboard组件中。仅使用first,而不是dashboard/first

 { path: '', children: [
    { path: '', component:DashboardComponent ,
        children:[
          { path: '', redirectTo:'first',pathMatch:'full' },
          { path: 'first', component: FirstComponent },
          { path: 'second', component: SecondComponent },
        ]  
     }, 
  ]},