Files
2015-10-01 18:11:38 -04:00

64 lines
1.5 KiB
TypeScript

import {App, Popup} from 'ionic/ionic';
@App({
templateUrl: 'main.html'
})
class E2EApp {
constructor(popup: Popup) {
this.popup = popup;
this.alertOpen = false;
this.promptOpen = false;
this.promptResult = '';
this.confirmOpen = false;
this.confirmResult = '';
}
doAlert() {
this.alertOpen = true;
this.popup.alert({
title: "New Friend!",
template: "Your friend, Obi wan Kenobi, just accepted your friend request!",
cssClass: 'my-alert'
}).then(() => {
this.alertOpen = false;
});
}
doPrompt() {
this.promptOpen = true;
this.popup.prompt({
title: "New Album",
template: "Enter a name for this new album you're so keen on adding",
inputPlaceholder: "Title",
okText: "Save",
okType: "secondary"
}).then((name) => {
this.promptResult = name;
this.promptOpen = false;
}, () => {
console.error('Prompt closed');
this.promptOpen = false;
});
}
doConfirm() {
this.confirmOpen = true;
this.popup.confirm({
title: "Use this lightsaber?",
subTitle: "You can't exchange lightsabers",
template: "Do you agree to use this lightsaber to do good across the intergalactic galaxy?",
cancelText: "Disagree",
okText: "Agree"
}).then((result, ev) => {
console.log('CONFIRMED', result);
this.confirmResult = result;
this.confirmOpen = false;
}, () => {
this.confirmOpen = false;
console.error('NOT CONFIRMED');
});
}
}