例如有效!
{ path: 'products/:id', component: ItemComponent,
children: [
{ path: 'gallery', component: GalleryComponent }
] },
{ path: 'products', component: ProductsComponent },
http//localhost:4200/products ---> (ProductsComponent) works!
http//localhost:4200/products/1 ---> (ItemComponent) works!
http//localhost:4200/products/1/gallery --->(GalleryComponent) works!
但是...在同一文件中不起作用!
{ path: 'category/:id', component: SinglecategoryComponent,
children: [
{ path: 'sub', component: SubcategoryComponent }
] },
{ path: 'category', component: CategoryComponent },
http//localhost:4200/category ---> (CategoryComponent ) works!
http//localhost:4200/category/1 ---> (SinglecategoryComponent) works!
http//localhost:4200/products/1/sub --->(SinglecategoryComponent) ¿? Not works!
Alguna的主意?
此
http//localhost:4200/products/1/sub
应显示
SubcategoryComponent
但应显示
SinglecategoryComponent
知道发生什么了吗?