Angular 添加参数后的路由我们如何添加子路由
Angular route after adding param how we can add sub route
举个例子:
'www.xyz.com/#/indutry/1/subIndustry/2/subSubIndustry/3'
我需要遵循这个结构如何 ForRoot 我的父路由文件
您需要两层嵌套子路由。
确保每条路线都有唯一的名称。
你的路线文件。
那个基本的例子,这取决于你的应用程序你想显示哪种数据。
const routes: Routes = [
{path: '', redirectTo: 'home', pathMatch: 'full'},
{path: 'home', component: HomeComponent},
{
path: 'indutry/:indutryId',
component: IndutryComponent,
children: [
{path: '', redirectTo: 'subIndustryone', pathMatch: 'full'},
{
path: 'subIndustryone/:subindustryOneId',
component: SubIndustryOneComponent,
children : [
{ path : '', redirectTo: 'subIndustrytwo', pathMatch : 'full' },
{ path : 'subIndustrytwo/:subindustryTwoId', component : SubIndustryTwoComponent },
]
},
]
},
{path: '**', component: HomeComponent}
];
举个例子: 'www.xyz.com/#/indutry/1/subIndustry/2/subSubIndustry/3'
我需要遵循这个结构如何 ForRoot 我的父路由文件
您需要两层嵌套子路由。
确保每条路线都有唯一的名称。
你的路线文件。
那个基本的例子,这取决于你的应用程序你想显示哪种数据。
const routes: Routes = [
{path: '', redirectTo: 'home', pathMatch: 'full'},
{path: 'home', component: HomeComponent},
{
path: 'indutry/:indutryId',
component: IndutryComponent,
children: [
{path: '', redirectTo: 'subIndustryone', pathMatch: 'full'},
{
path: 'subIndustryone/:subindustryOneId',
component: SubIndustryOneComponent,
children : [
{ path : '', redirectTo: 'subIndustrytwo', pathMatch : 'full' },
{ path : 'subIndustrytwo/:subindustryTwoId', component : SubIndustryTwoComponent },
]
},
]
},
{path: '**', component: HomeComponent}
];