How to get parameters in in ionic-v4

i have sent parameters in modal. but how can i get that parameters in through routing?

  async openModal() {
    let modal = await this.modalCtrl.create({
      component: ModalassignPage,
      componentProps: {'PID':'123'}
    return await modal.present();

Like this, using NavParams
–> [Ionic 4] Get data in modal passed with componentProps

No MattE, i m able to get through NavParams but i want through Routing. Because NavParams will be removed in V4.

i m using this code but getting empty array

this.route.params.subscribe( paramss => {

What’s your source? Yes no more navparams for navigation but where did you read that navparams would be removed for passing data between modals and popovers?

i m curious about future of app. actually we can get those parameters from routing also. so i m just trying. btw no where mentioned that. :slight_smile:

import { Component, OnInit  } from '@angular/core';
import { Router, ActivatedRoute, ParamMap } from '@angular/router';

other code

 ngOnInit() {
     .subscribe((queryParams: ParamMap) => {
        let PID = queryParams.get('PID');

Thanks bgies, but still getting null :frowning:

i tried this too but getting null


Found the way here:

1 Like

for me the following worked

Hi, try this : this.activatedRoute.snapshot.paramMap.get('PID')

This should be considered as the correct answer.