Mohamad nagi
Mohamad nagi

Reputation: 101

ionic - this.navctrl.push() NotWorking

I make API Call and when response success navigate to another page as you will see. the Call return response but don't push to another page.

My Function :

signup() {
  this.showLoader();
  this.authService.postData(this.userData, 'Regestier').then((result) => {
      this.responseData = result;
      console.log(this.responseData);

      localStorage.setItem('userData', this.responseData);
      this.navCtrl.push(DashboardPage);
      this.loading.dismiss();

    },

    (err) => {
      // Error log
      this.loading.dismiss();

    });

}

Upvotes: 0

Views: 309

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222532

Can you try with setRoot. That way the new component is the root, which in your case would be the DashboardPage.

this.navCtrl.setRoot(DashboardPage, {}, {animate: true, direction: 'forward'});

Upvotes: 1

Related Questions