点击通知后重定向到离子页面

时间:2017-09-02 16:38:50

标签: typescript ionic-framework

我正在使用Ionic和Firebase测试javebratt的fitCoach推送通知示例。 javebratt / fitCoach

推送到达良好但是当页面重定向发生时,我在手机上看到以下错误。

Error seen on device when clicking on notification, page redirection should happen here

Line in app.component.ts where navCtrl error is trigered

app.component.ts中的代码如下:

platform.ready()。then(()=> {

    fcm.onNotification().subscribe( data => {
      if(data.wasTapped){
        authUnsubscribe.unsubscribe();
        //Notification was received on device tray and tapped by the user.
        console.log( JSON.stringify(data) );
        this.navCtrl.setRoot('ClientDetailPage', { 'clientId': data.clientId});
      }else{
        //Notification was received in foreground. Maybe the user needs to be notified.
        console.log( JSON.stringify(data) );
        this.navCtrl.push('ClientDetailPage', { 'clientId': data.clientId});
      }
    });


  // Okay, so the platform is ready and our plugins are available.
  // Here you can do any higher level native things you might need.
  statusBar.styleDefault();
  splashScreen.hide();
});

我从github克隆了他的回购,有什么建议吗?

由于

1 个答案:

答案 0 :(得分:0)

javebratt找到了答案,src / app / app.html中缺少#myNav

https://github.com/javebratt/fitCoach/commit/f89d5dcdd0080c38727f889c70517fd219b5b44a