i have sent parameters in modal. but how can i get that parameters in modal.page.ts through routing?
async openModal() {
let modal = await this.modalCtrl.create({
component: ModalassignPage,
componentProps: {'PID':'123'}
});
return await modal.present();
}
MattE
August 4, 2018, 5:20pm
2
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 => {
console.log(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.
bgies
August 5, 2018, 1:55am
7
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, ParamMap } from '@angular/router';
other code
ngOnInit() {
this.activatedRoute.paramMap
.subscribe((queryParams: ParamMap) => {
let PID = queryParams.get('PID');
});
}
Thanks bgies, but still getting null
i tried this too but getting null
this.route.snapshot.paramMap.get('PID');
voodark
February 12, 2019, 7:40am
10
for me the following worked
this.route.snapshot.params.P’ID
nesbhm
February 12, 2019, 3:42pm
11
Hi, try this : this.activatedRoute.snapshot.paramMap.get('PID')
This should be considered as the correct answer.