例如,工作!
{ 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!阿尔古纳的点子?
这
http//localhost:4200/products/1/sub 应该显示
SubcategoryComponent 但应该显示出来
SinglecategoryComponent 知道可能发生了什么吗?
发布于 2020-04-27 17:43:29
这个url http//localhost:4200/products/1/sub不正确吗?根据您的路由配置,它应该是http//localhost:4200/category/1/sub。
https://stackoverflow.com/questions/61455820
复制相似问题