本文整理匯總了TypeScript中ionic-angular/index.Alert.create方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Alert.create方法的具體用法?TypeScript Alert.create怎麽用?TypeScript Alert.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ionic-angular/index.Alert
的用法示例。
在下文中一共展示了Alert.create方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
this.authService.loginUser(loginData.userId, loginData.userPassword).then((result) => {
if (result) {
//console.log(result);
/*this.nav.push(WelcomePage, {
info: result
});*/
if(result['type'] == "student"){
this.nav.setRoot(WelcomeStudentPage, { info: result });
}
if(result['type'] == "teacher"){
this.nav.setRoot(WelcomeTeacherPage, { info: result });
}
} else {
let alert = Alert.create({
title: 'Login failure!',
subTitle: 'Please check your userId and Password and log in back!',
buttons: [{
text: 'OK',
handler: () => {
//console.log('inside the button click');
this.nav.pop();
}
}]
});
this.nav.present(alert);
}
}).catch((err) => {
示例2: showAlert
public showAlert(title:string, message:string) {
let alert = Alert.create({
title: title,
subTitle: message,
buttons: ['OK']
});
this._nav.present(alert);
}
示例3: logout
logout() {
console.log('inside the log out call' + this.userInfo.userId);
this.authService.loginOut(this.userInfo);
let alert = Alert.create({
title: 'Logout confirmation!',
subTitle: 'Will be Log out from the Site!',
buttons: [{
text: 'OK',
handler: () => {
this.nav.setRoot(TabsPage);
}
}]
});
this.nav.present(alert);
}