Passing parameters from app.component.ts


Hi there

Still a bit new with Ionic 2 but would like to know if it is possible to pass a string parameter from app.component.ts.

Where I set the root page. this.rootPage = HomePage;

I want to pass this string to the HomePage


What do you want to pass to where and what exactly do you need it for?


during navigation you would pass those stuff with navParams.

If you would have an ordinary component you would use inputs (@Input)

In your case it is a little bit strangeā€¦ maybe you should explain why you want to pass data to this component.

I would create a service --> with a function that creates a long living observable.
AppComponent would set data the observable would spread to all subscribers --> so you HomePage would subscribe to this value.


I did manage thanks

I was under the impression that an instance of push would only be available on start up of the app and that I had to somehow send the device token to wherever I needed to navigate as I wanted to associate this token with the user details and save it in the database.

It does however appear as if this token is globally available.

Thanks abyway