Home > Software design >  Send Multiple parameters between components with Navigate and ParamMap
Send Multiple parameters between components with Navigate and ParamMap

Time:11-12

My issue is actually that i don't know how to send more than one parameter thorugh the route of the component.

I want to send two attribute. Does the definition of the route has to have something special?

Here is what is (Or what i want to accomplish) in the component that sends the attributes.

 public editBug(bugName:string){

    this.router.navigate(['bug-update', bugName, this.projectName])
  }

The one that recieves the URI

ngOnInit() {
    let bugName = this.activeRouter.snapshot.paramMap.get('bug');
    let projectName = this.activeRouter.snapshot.paramMap.get('project');

    if(bugName != null && projectName != null){
    this.bugName = bugName;
    this.projectName = projectName
    }
  }

And the route of the component

  {path : 'bug/:bug:project', component: BugComponent}

CodePudding user response:

{ path: 'bug/:id1/:id2', component: BugComponent}
  • Related