2017-02-01 5 views
0

나는 2 각도에서 초보자이며 일부 라우팅 연습을하려고합니다. productDetailComponent에 버튼이 있습니다. 이제 버튼을 클릭하면 페이지가 moreDetailComponent로 라우팅됩니다.각도 2 - 중첩 된 라우팅

export const TutorialRoutes: Routes =[ 
i w 
    { 
    path: 'Company', 

    component: CompanyComponent, 
    children: [ 
     {path: '', redirectTo: 'people'}, 
     {path: 'price', component: PriceComponent}, 

     {path: 'products', component: ProductComponent, 

     children:[ 

      {path: '', redirectTo:'product-details'}, 
      {path:'product-details', component:ProductDetailsComponent}, 
      {path:'more',component: MoreDetailsComponent} 

     ] 

     }, 


    ] 

    } 
]; 

// 버튼 페이지로 이동 (moreDetailsComponent)

<button routerLink="more">Add</button> 

답변

1

추측 /에서에

<button routerLink="../more">Add</button> 
+0

의 URL 변경 (문제는 나에게 매우 명확하지 않기 때문에) 세부 정보는/이상이지만 페이지는 변경되지 않았습니다. –

+0

경로가 'Company/products/product-details'이어야하고 버튼이'ProductDetailsComponent'에 있으면 'Company/products/more'로 변경하십시오. 버튼이 다른 곳에 있으면 작동하지 않아야합니다. –

+0

예, 버튼이 ProductDetailsComponent에 있습니다. 버튼을 클릭하면 URL이 바뀌지 만 페이지가 moreDetailsComponent로 이동하지 않습니다. –