1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

passing value via navigateByUrl with navigationExtras empty

Discussão em 'Angular' iniciado por DarkVision, Outubro 10, 2024 às 06:12.

  1. DarkVision

    DarkVision Guest

    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');
    }


    }

    Continue reading...

Compartilhe esta Página