Passing Multiple route params in Angular2

前端 未结 4 1425
耶瑟儿~
耶瑟儿~ 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条回答
  •  孤独总比滥情好
    2021-01-31 01:54

    OK realized a mistake .. it has to be /:id/:id2

    Anyway didn't find this in any tutorial or other StackOverflow question.

    @RouteConfig([{path: '/component/:id/:id2',name: 'MyCompB', component:MyCompB}])
    export class MyCompA {
        onClick(){
            this._router.navigate( ['MyCompB', {id: "someId", id2: "another ID"}]);
        }
    }
    

提交回复
热议问题