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