How to send navparams get to provider and get in other page?

#1

Hello, I want to send navparams get data to my provider and get in other page.

My page : rental.ts

My provider : share.ts
shareprovider

How to resolve this ? thank you.

#2

Hello,

Use preformatted text icon to insert code instead of pictures. It is better readable.

I guess you have imported your ShareService correctly.
You have injected it in the constructor with
public service: ShareService

Now you can use it like anything else you have injected via constructor

this.service.kategori_user = this.....

maybe I think to simple.

Best reagards, anna-liebt

#3

Thank you for your answer, but still not work.

#4

I do not get your requirement correctly. But I guess you want to pass data to another page.
Two ways,
1-
You can send data when opening the next page like this,
this.navCtrl.push('NextPage', {data1: data1, data2: data2, data3: data3});

2-
Or you can use a service.
Set data before opening the page

this.sharedPageDataService.data1 = data1;
this.sharedPageDataService.data2 = data2;
this.navCtrl.push('NextPage');

then get data from the next page

this.data1 = this.sharedPageDataService.data1;
this.data2 = this.sharedPageDataService.data2;

You can even create a method in the service to push data to an array and and clear when some page gets data.