Tonye Boro
Tonye Boro

Reputation: 313

Passing API data from one page to another in ionic 3

Let's say I have something like this:

this.http.post('http://edomonitor.com/school-evaluation-api/retrieve_data.php',data, options)
.map(res => res.json())
    .subscribe(res => {
     loader.dismiss()
    this.items=res.server_response;
    console.log(this.items);

    });

How can I pass the call data across all pages?

Upvotes: 0

Views: 395

Answers (1)

Mustafa Lokhandwala
Mustafa Lokhandwala

Reputation: 814

You have to make a dictionary object like this

savePedoData() {
    let data = {
      steps: this.count
    };
    this.navCtrl.push(PAGE_NAME, data);
}

and In second page

steps = this.navParams.get("steps");
console.log(steps);

you can find your data into the log

Upvotes: 1

Related Questions