Popup close

This commit is contained in:
Max Lynch
2015-07-21 13:02:16 -05:00
parent 730345dcb4
commit 1df6ca08cb

View File

@@ -10,10 +10,16 @@ export class Popup extends Overlay {
alert(context={}, opts={}) {
if(typeof context === 'string') {
let button = {
text: 'Ok',
onTap: (event, popupRef) => {
// Allow it to close
}
}
context = {
title: context,
buttons: [
{ text: 'Ok' }
button
]
}
}
@@ -62,7 +68,12 @@ class StandardPopup {
this.popup = popup;
}
buttonTapped(button, event) {
console.log('TAPPED', button, event);
button.onTap && button.onTap(event, this);
// If the event.preventDefault() called, don't close
if(!event.defaultPrevented) {
return this.overlayRef.close();
}
}
_cancel() {
this.cancel && this.cancel();