Navigation in app.ts

HI everyone,

I’m a new developer use Ionic v2 framework. I have a issue about navigation in “app.ts”. Currently, I implemented code to receive notification from server push to in the “app.ts” file.

push.on(‘notification’, (data) => {
// navigate to a specific page
// code here

But I can’t think anyway to work. Please help me If you can.

Vang Doan

Please read

Hi itlr,

Thank you very much.

Vang Doan

Hi itlr,

Could you help me one more :slight_smile:

In “app.ts”, I have “this.rootPage = TabsPage;” when I receive a push notification, I invoke:

  var _rootPage = this.rootPage; // get TabsPage
  var rootTab  = _rootPage.getRootTab(); // In class TabsPage I have a function getRootTab()

But I get a error “Error in Success callbackId: PushNotification1881844672 : TypeError: undefined is not a function (evaluating ‘_rootPage.getRootTab()’)”

Vang Doan

And what if you log _rootPage? Is that object null?

Hi maxxOr,

when i try “console.log(_rootPage);”

–> output:

function TabsPage() {
// this tells the tabs component which Pages
// should be each tab’s root Page
this.connectionRoot = connection_1.ConnectionPage;
this.mainRoot = sign_in_1.SignInPage;
this.tab1Root = home_1.HomePage;
this.tab2Root = journey_1.JourneyPage;
this.tab3Root = helps_1.HelpsPage;
this.tab4Root = camera_1.CameraPage;

And rootTab = undefine

Vang Doan

Hi maxx0r,

I think the “_rootPage” is not a instance of class TabsPage so I get an error.

But I don’t know way to get instance of TabsPage.

Vang Doan