本文整理匯總了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);
}