本文整理汇总了TypeScript中ionic-angular.Alert类的典型用法代码示例。如果您正苦于以下问题:TypeScript Alert类的具体用法?TypeScript Alert怎么用?TypeScript Alert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Alert类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: deleteGroup
deleteGroup(event, group) {
let confirm = Alert.create({
title: 'Você deseja deletar o grupo?',
message: 'Ao concordar todo o histórico do grupo será deletado',
buttons: [
{
text: 'Não',
handler: () => {
console.log('Disagree clicked');
}
},
{
text: 'Sim',
handler: () => {
this.groupProvider.delete(group).then(() => {
this.groups.splice(this.groups.indexOf(group), 1);
}, (error) => {
console.log(error);
});
}
}
]
});
this.navCtrl.present(confirm);
}
示例2: signInWithOnyx
private signInWithOnyx(form:{emailControl:string, passwordControl:string}):void {
if (Meteor.isCordova) {
var self = this;
console.log("form: ", form);
Session.set("email", form.emailControl);
Meteor.call('isEmailRegistered', form.emailControl.toLowerCase(), function (error, result) {
if (error) {
new ToastMessenger().toast({
type: "error",
title: "Sign In Error",
message: error.message
});
} else if (!result) {
console.log("User not found");
Session.set("registeredError", true);
self.emailControl.updateValueAndValidity(true);
} else {
new OnyxHelper(self.nav, self.translate).execOnyx({action: Onyx.Action.TEMPLATE});
Session.set("signInWithOnyx", form.emailControl.toLowerCase());
}
});
} else {
console.log("This feature is only available on cordova devices.");
let alert = Alert.create({
title: "Cordova Only!",
message: "This feature is only available on cordova devices.",
buttons: ["OK"]
});
this.nav.present(alert);
}
}
示例3: removeItemFromCart
removeItemFromCart(item){
//this.cartService.removeItemById(item.id);
let self = this;
let alert = Alert.create({
title: 'Confirm Delete',
message: 'Are you sure you want to remove food item from cart?',
buttons: [
{
text: 'Cancel',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
},
{
text: 'Remove',
handler: () => {
console.log('Buy clicked');
self.cartService.removeItemById(item.id);
}
}
]
});
this.nav.present(alert);
}
示例4: createTodo
createTodo(){
let prompt = Alert.create({
title: 'Add',
message: 'What do you need to do?',
inputs: [
{
name: 'title'
}
],
buttons: [
{
text: 'Cancel'
},
{
text: 'Save',
handler: data => {
this.todoService.createTodo({title: data.title});
}
}
]
});
this.nav.present(prompt);
}
示例5:
}).then(() => {
let prompt = Alert.create({
message: "Save Data",
buttons: [{ text: "Ok" }]
});
this.nav.present(prompt);
});
示例6: renameItem
renameItem(item): void{
let prompt = Alert.create({
title: 'Rename Item',
message: 'Enter the new name of your new task below:',
inputs: [
{
name: 'name'
}
],
buttons: [
{
text: 'Cancel'
},
{
text: 'Save',
handler: data => {
this.checklist.renameItem(item);
}
}
]
});
this.nav.present(prompt);
}
示例7: alert
alert(msg) {
let prompt = Alert.create({
message: msg,
buttons: [{text: "Ok"}]
});
this.nav.present(prompt);
}
示例8: function
NavController.prototype.alert = function (message: string): void {
let alert = Alert.create({
message: message,
buttons: ['OK']
});
this.present(alert);
}
示例9:
}, (status, response) => {
if (response.error || !response.id) {
let popup = Alert.create({
title: 'Payment Error',
subTitle: 'Please try again',
buttons: ['Dismiss']
});
this.loading = false;
this.nav.present(popup);
} else {
let request = { id: this.meetup.id, token : response.id}
this.http.makeBackendRequest('POST', 'meetup/payement', request,
response => {
HttpService.showAlert(this.nav, "Its all good !", "Your presence has been confirmed ! Thanks you", {
text: 'Ok',
handler: () => {
this.nav.popToRoot();
}
});
}, errorMessage => {
// BECAUSE WHY NOT
if (Object.keys(errorMessage).length == 0) {
HttpService.showAlert(this.nav, "Its all good !", "Your presence has been confirmed ! Thanks you", {
text: 'Ok',
handler: () => {
this.nav.popToRoot();
}
});
}
else {
HttpService.showAlert(this.nav, "Error code : " + errorMessage.status, "We got an internal problem, please retry.", "Ok");
}
}, true);
}
});
示例10: clicked
clicked() {
let prompt = Alert.create({
title: 'New Item',
message: "Enter the name of the item",
inputs: [
{
name: 'title',
placeholder: 'Title'
},
],
buttons: [
{
text: 'Cancel',
handler: data => {
console.log('Cancel clicked');
}
},
{
text: 'Save',
handler: data => {
ShoppingLists.insert({name:data.title,listId:this.par,completed:false});
}
}
]
});
this.nav.present(prompt);
}