passing value via navigateByUrl with navigationExtras empty

Viewed 8963

Hi i have a function that navigate to another page and passing a id to another component but it return nothing to the other component. Not sure what i am doing wrong could someone point me in the right direction.

gotoConsulting(questionId: number): void {   

   let navigationExtras: NavigationExtras = {
      queryParams: { 'origine': questionId.toString },
      fragment: 'anchor'
   };
  console.log("idquestion"  + questionId);
    this._router.navigateByUrl('/consulting',navigationExtras);
}

here the component that get redirect but always return in the view None

export class PageConsulting implements OnInit {

  origine: Observable<string>;

  constructor(private route: ActivatedRoute) {}

  ngOnInit(): void {
      this.origine = this.route
      .queryParamMap
      .map(params => params.get('origine') || 'None');
  }


}
2 Answers

Using the navigate() function appears to cause issues with routes that use the !# prefix in Angular

Related