Navigate relative with Angular 2 Router (Version 3)

前端 未结 4 1469
野性不改
野性不改 2021-02-01 12:31

How to navigate relative from /questions/123/step1 to /questions/123/step2 within a component using Router without string concatenation an

4条回答
  •  日久生厌
    2021-02-01 12:39

    You may use below,

    Assumption is questions is loaded into your primary router-outlet

      this.router.navigate([
          '/',
          { 
            outlets: {
              primary: [
                  // below may be replaced with different variables
                  'questions',
                  '123',  
                  'step2'
              ]
            }
          }
      ])
    

    Hope this helps!!

提交回复
热议问题