本文整理匯總了TypeScript中@ionic/angular.NavController.navigateRoot方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript NavController.navigateRoot方法的具體用法?TypeScript NavController.navigateRoot怎麽用?TypeScript NavController.navigateRoot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ionic/angular.NavController
的用法示例。
在下文中一共展示了NavController.navigateRoot方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: checkOnline
/**
* checkOnline
*
* returns connection state. Set showAlert and/or sendHome to true to show an alert
* about the connection state or/and send the user to HomePage
* @return Observable<boolean>
*/
checkOnline(showAlert: boolean = false, sendHome: boolean = false): EConnection {
if (this.connectionState === EConnection.OFFLINE) {
if (showAlert && !sendHome) {
this.alertService.showToast('alert.network');
} else if (showAlert && sendHome) {
const buttons: AlertButton[] = [{
text: this.translate.instant('button.continue'),
handler: () => {
this.navCtrl.navigateRoot('/home');
}
}];
this.alertService.showAlert(
{
headerI18nKey: 'alert.title.httpError',
messageI18nKey: 'alert.network'
},
buttons
);
}
if (!showAlert && sendHome) {
this.navCtrl.navigateRoot('/home');
}
}
console.log(`[ConnectionProvider]: App is ${EConnection[this.connectionState]}`);
return this.connectionState;
}
示例2: login
login(){
this.navCtrl.navigateRoot(['/home']);
}
示例3:
handler: () => {
this.navCtrl.navigateRoot('/home');
}
示例4: ionViewDidEnter
ionViewDidEnter() {
this.navController.navigateRoot('/navigation/page2');
}
示例5: visaoEvento
visaoEvento(){
this.navCtrl.navigateRoot(['/visao-evento']);
}