After model page work, I can’t move another page from the modal page. How to move another page on click in modal button?
Modal Button:
<ion-row style="margin-top: 10px;"> <ion-col> <p class="login-text">You have account <span (click)="Login()">Login</span></p> </ion-col> </ion-row>
TS code:
Login(){ this.viewCtrl.dismiss(); this.navCtrl.setRoot(DashboardPage); }
It not work, I can’t move dashboard page after login success.
You have to use Events for do this work
Open app.components.ts page and apply this code:
constructor(public platform: Platform, private storage: Storage,private events: Events) { this.initializeApp(); this.listenToLoginEvents(); events.subscribe('user:changed', (user, time) => { this.nav.setRoot(DashboardPage); }); }
And now Page.ts:
import { Events } from 'ionic-angular';
Function:
Login(){ this.events.publish('user:changed', "openDashboard", Date.now()); this.viewCtrl.dismiss(); }
Hope it will work for you.
Question and answer is powered by AnsPress.io