Angular6 如何以角度传递额外的路由参数?
我在Angular 6应用程序上工作,并在应用程序根级别上配置了route survey,然后:id获取它的调查详细信息页面,我尝试使用Angular6 如何以角度传递额外的路由参数?,angular6,angular-routing,Angular6,Angular Routing,我在Angular 6应用程序上工作,并在应用程序根级别上配置了route survey,然后:id获取它的调查详细信息页面,我尝试使用 this.router.navigate(['/survey'], this.listedSurvey.surveyIdNum); 但我相信我错过了一些东西,因为我无法做到这一点 应用程序路径 调查模块 成分 更改导航() this.router.navigate(['/survey',this.listedSurvey.surveyIdNum]) 参考:
this.router.navigate(['/survey'], this.listedSurvey.surveyIdNum);
但我相信我错过了一些东西,因为我无法做到这一点
应用程序路径
调查模块
成分
更改导航()
this.router.navigate(['/survey',this.listedSurvey.surveyIdNum])代码>
参考:
const routes: Routes = [
{ path:'welcome', component:WelcomeComponent },
{ path:'', redirectTo: 'welcome', pathMatch:'full'},
{ path:'survey', loadChildren: '../survey/survey.module#SurveyModule' },
{ path:'**', component:PageNotFoundComponent}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [
RouterModule
]
})
export class AppRoutingModule { }
const routes: Routes = [
{
path:'',
component:SurveyComponent,
},
{
path:':id',
component: SurveyFormComponent
}
];
@NgModule({
imports:[
RouterModule.forChild(routes)
],
exports:[]
})
export class SurveyRouting{
}
private handleSelectedSurvey(dataItem:any){
this.listedSurvey = dataItem;
const a:number = 2;
//this.router.navigate(['/survey'], this.listedSurvey.surveyIdNum);
this.router.navigate(['/survey'],{queryParams:{id:a}});
}