Files
Brandy Carney d4c2342414 feat(button): Added ability to give the button a "type" which will be converted to an attribute.
Note this is working for basic buttons but breaks in the popup
currently, that is a TODO. Changed the default to types for the popup
to an empty string. Closes #183
2015-10-05 12:37:50 -04:00

63 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"
}).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');
});
}
}