Passing Json Data to Second Page for Audio player


Hi , Please can someone help me with this implementation of Media Player fetching from Remote Json. I’m using this Remote data to list Artist, Image but want to pass Audio URL to Player page. Any suggestion on how to implement this?


You can either use Navigation Params to pass the data on to the Player page or create some sort of Helper component, which you load in your app.component.ts constructor and pass on to the various pages that need to access temporary data.

The Ionic Documentation has everything you need to start using NavParams. =>


Thanks @duke1102 for looking to this. I tried using navCtrl to push the Second and pass the Json data along like below

    this.navCtrl.push(SecondPage, this.newsData);

and navParams to get the Passed data with below code


Any time I click the Launch function to access the data passed I get Undefined in Console.


try with localStorage , exemple :

insert your link in any page


get your link in another page



Hey. Try changing your push to like this:

this.navCtrl.push(SecondPage, { Link: this.newsData });

This way you make sure the data gets passed over with the identifier Link which you try to get with your navParams.get(‘Link’) call.

You can also provide more than only one Parameter like so:

this.navCtrl.push(SecondPage, { Param1: this.stuff, Param2: this.morestuff, Param3: this.evenmorestuff });

In my experience that doesn’t work so well and also the way you describe it is rather… old. I saw this localStorage stuff in an old V1 app, but it didn’t work at all in V3.
For Ionic >=2 I found a pretty decent example for using the local storage of your browser in one of the example projects.

It basically uses Promises when you try to get a value. Another important thing is to make sure that the local storage is actually ready and initialised, before reading/writing it.
Easiest way is to just check that in the app.component.ts after Platform.ready().


@duke1102 Thank for time. I just tried this and The undefined I got from solved if I’m correct. So I tried logging this to console


Unfortunately I couldn’t I couldn’t see anything from console.
Thanks once Again


You can’t just blindly copy stuff. NavParams must be injected in the page’s controller:

class SecondPage {
  constructor(np: NavParams) {