Passing Multiple route params in Angular2

前端 未结 4 1431
耶瑟儿~
耶瑟儿~ 2021-01-31 00:51

Is it possible to pass multiple route params e.g. like below need to pass id1 and id2 to the component B

@RouteConfig([
           


        
4条回答
  •  旧时难觅i
    2021-01-31 01:46

    As detailed in this answer, mayur & user3869623's answer's are now relating to a deprecated router. You can now pass multiple parameters as follows:

    To call router:

    this.router.navigate(['/myUrlPath', "someId", "another ID"]);
    

    In routes.ts:

    { path: 'myUrlpath/:id1/:id2', component: componentToGoTo},
    

提交回复
热议问题