本文整理匯總了TypeScript中ionic-angular.Alert.create方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Alert.create方法的具體用法?TypeScript Alert.create怎麽用?TypeScript Alert.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ionic-angular.Alert
的用法示例。
在下文中一共展示了Alert.create方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: confirmarPedido
confirmarPedido(){
if(!this.ps.user){
this.nav.present(Alert.create({title:"Advertencia", message:"Debe iniciar sesión para realizar pedidos", buttons: ["ok"]}))
return;
}
if(!(this.ps.selectedAddress != undefined && this.ps.addresses[this.ps.selectedAddress])){
this.nav.present(Alert.create({title:"Advertencia", message:"Debe elegir una dirección para realizar pedidos", buttons: ["ok"]}))
return;
}
let ConfirmarAlert = Alert.create({
message:"¿Esta Seguro de que desea procesar el Carrito?",
title:'Confirmar',
buttons:
[
{
text: 'Aun No',
handler: () => {
console.log('Disagree clicked');
}
},
{
text: 'Confirmar',
handler: () => {
this.procesarCarrito();
}
}
]
});
this.nav.present(ConfirmarAlert);
}
示例2: showMessage
showMessage(message: string, type: number){
/*
1 = status
2 = success
3 = error
*/
if (type == 1) {
let alert = Alert.create({
title: '',
subTitle: message,
buttons: ['OK']
});
this.nav.present(alert);
} else if (type == 2) {
let alert = Alert.create({
title: 'Success!',
subTitle: message,
buttons: ['OK']
});
this.nav.present(alert);
} else if (type == 3) {
let alert = Alert.create({
title: 'Error!',
subTitle: message,
buttons: ['OK']
});
this.nav.present(alert);
}
return;
}
示例3: fireRestPassword
fireRestPassword() {
if (this.newPassword !== this.newPassword1) {
let alert = Alert.create({
title: '兩次輸入的新密碼不一致!',
buttons: ['OK']
});
this.nav.present(alert);
} else if (this.password !== '1' || this.newPassword !== '1' || this.newPassword1 !== '1') {
let alert = Alert.create({
title: '密碼不正確!',
buttons: ['OK']
});
this.nav.present(alert);
} else {
let alert = Alert.create({
title: '密碼修改成功!',
buttons: [{
text: 'OK', handler: data => {
setTimeout(()=> this.nav.pop(), 500);
}
}]
});
this.nav.present(alert);
}
}
示例4: renameItem
renameItem(item): void {
let prompt = Alert.create({
title: 'Rename Item',
message: 'Enter the new name of the task for this checklist below:',
inputs: [
{
name: 'name'
}
],
buttons: [
{
text: 'Cancel'
},
{
text: 'Save',
handler: data => {
this.checklist.renameItem(item, data.name);
}
}
]
});
this.nav.present(prompt);
}
示例5: addNewChapter
addNewChapter(){
let prompt = Alert.create({
title: 'New Chapter',
message: "Enter name of chapter",
inputs: [
{
name: 'chapter',
placeholder: 'Chaoter'
}
],
buttons: [
{
text: 'Cancel',
handler: data => {
console.log('Cancel clicked');
}
},
{
text: 'Save',
handler: data => {
console.log(data.chapter);
//call db
console.log('Added');
}
}
]
});
this.nav.present(prompt);
}
示例6: clearAllPodcasts
public clearAllPodcasts() {
let alertClearAll = Alert.create({
title: "Supprimer tous les podcasts ?",
message: 'Ceci est utilisé à des fins de développement ou si votre application est bloquée',
buttons: [
{
text: "Non",
handler: () => {
alertClearAll.dismiss();
}
},
{
text: "Oui",
handler: () => {
let loading = Loading.create({
content: 'Suppression en cours...'
});
this.navController.present(loading);
this.podcastService.clearAll().then(() => {
this.podcastService.updatePodcasts().then(() => {
loading.dismiss();
});
});
}
}
]
});
this.navController.present(alertClearAll);
}
示例7: login
login(username:string,password:string,rememberMe:boolean):Observable<any> {
if(username.toLowerCase() !== 'admin' || password.toLowerCase() !== 'admin') {
let alert = Alert.create({
title: 'Invalid credentials',
subTitle: 'You entered invalid credentials !',
buttons: ['Ok']
});
return Observable.throw(alert);
} else {
let headers = new Headers();
headers.append(CONTENT_TYPE_HEADER, APPLICATION_JSON);
return this.http.post(BACKEND_URL,JSON.stringify({login:username,password:password}),{headers:headers}).map((res:Response) => {
let loginData:any = res.json();
let user:User = this.readJwt(loginData.token);
user.username = username;
user.password = password;
console.log('Login successful', user);
if (rememberMe) {
console.log('Remember me: Store user and jwt to local storage');
StorageUtils.setAccount(user);
StorageUtils.setToken(loginData.token);
}
return user;
});
}
}
示例8: follow
follow(){
let alert = Alert.create({
title: '請輸入跟投份數',
inputs: [
{
label: '跟投份數',
name: 'follow_num',
placeholder: '請輸入跟投份數',
type: 'number',
value: '1'
}
],
buttons: [
{
text: '取消',
role: 'cancel',
handler: data => {
console.log('Cancel clicked');
}
},
{
text: '確認',
handler: data => {
console.log(data.follow_num);
this.nav.push(SuccessPage, {
item: data.follow_num
});
}
}
]
});
this.nav.present(alert);
}
示例9: askForPassword
askForPassword(onOkClick: OnConfirmPassCallback, onCancelClick?: OnCancelCallback) {
let prompt = Alert.create({
title: 'Login',
message: "Please, enter the password to proceed with the operation",
inputs: [
{
name: 'pass',
type: "password",
placeholder: 'Password'
},
],
buttons: [
{
text: 'Ok',
handler: data => {
if (onOkClick != undefined) {
onOkClick(String(data.pass));
}
}
},
{
text: 'Cancel',
handler: data => {
if (onCancelClick != undefined) {
onCancelClick();
}
}
}
]
});
this.nav.present(prompt);
}
示例10: updateTodo
updateTodo(todo){
let prompt = Alert.create({
title: 'Edit',
message: 'Change your mind?',
inputs: [
{
name: 'title'
}
],
buttons: [
{
text: 'Cancel'
},
{
text: 'Save',
handler: data => {
this.todoService.updateTodo({
_id: todo._id,
_rev: todo._rev,
title: data.title
});
}
}
]
});
this.nav.present(prompt);
}