如何将下面的浏览器URL写入routing.module路径。我尝试了以下路径:"disciplines:disciplineId:&disciplineView",
,但无法访问。
浏览器URL http://localhost:4200/xxx/disciplines?disciplineId=12975&disciplineView=create
TS路由
{
path: "disciplines:disciplineId:&disciplineView",
component: DisciplinesComponent,
data: {
title: 'Disciplines',
breadcrumb: [
{
label: 'disciplines',
url: '/disciplines'
},
{
label: 'page {{customText}}',
url: ''
}
]
},
}
答案 0 :(得分:0)
在路由模块中,您仅需要指定主网址(而不是queryParams),就像这样:
{
path: "disciplines", component: DisciplinesComponent,
}
例如,当您想使用学科ID = 12975&disciplinelineView = create时,必须指定如下所示的queryParams:
1-具有routerLink:
<a [routerLink]="['/disciplines']" [queryParams]="{disciplineId: 12975,disciplineView: 'create' }"
2-使用导航方法:
this.router.navigate(['disciplines'], {queryParams: {
disciplineId: 12975, disciplineView: 'create'
}
})