I have an $ionicPopup.alert, but I don’t want it to pop up when the keyboard is open. I thought I could simply test ionic.keyboard.isOpen but it doesn’t seems to work. I can create my own flag like this and it works fine:
var keyboardIsOpen = false;
window.addEventListener('native.keyboardshow', function keyboardShowHandler(e) {keyboardIsOpen = true;});
window.addEventListener('native.keyboardhide', function keyboardShowHandler(e) {keyboardIsOpen = false;});
setInterval(function(){
if (!keyboardIsOpen) { // why not ionic.keyboard.isOpen ?
$ionicPopup.alert({title:'Alert',template:'Doh!'});
}
}, 5000);
Is there a better way to do this?
(I do have the Ionic keyboard plugin loaded obviously, since the event listeners are picking up native.keyboardshow/hide.)