send data in navigation using ionic5
https://ionicacademy.com/pass-data-angular-router-ionic-4/
send page:
receive page::
send page:
import { Router, NavigationExtras } from '@angular/router';
let paymentDetails = {
amount: this.ElectricityForm.value.Amount,
provider_code: this.providercode,
connection_provider: this.ElectricityForm.value.SelectBoard,
account_number: this.ElectricityForm.value.ConsumerNO,
bill_type: "payment",
type: "electric",
selectstate:this.ElectricityForm.value.SelectState,
statecode:this.statecode
}
let navigationExtras: NavigationExtras = {
queryParams: {
special: JSON.stringify(paymentDetails)
}
};
this.router.navigate(["/paybillpayment-options"],navigationExtras)
receive page::
import { ActivatedRoute, Router } from '@angular/router';
constructor(private route: ActivatedRoute, private router: Router) {
this.route.queryParams.subscribe(params => {
if (params && params.special) {
this.data = JSON.parse(params.special);
console.log(this.data)
}
});
Comments
Post a Comment