Everything is an option

This commit is contained in:
Max Lynch
2013-11-11 09:08:15 -06:00
parent 787101708d
commit 1cda55efd7
3 changed files with 15 additions and 9 deletions

View File

@ -4,7 +4,8 @@
ionic.views.Modal = ionic.views.View.inherit({
initialize: function(opts) {
opts = ionic.extend({
focusFirstInput: true
focusFirstInput: true,
unfocusOnHide: true
}, opts);
ionic.extend(this, opts);
@ -23,9 +24,11 @@
this.el.classList.remove('active');
// Unfocus all elements
var inputs = this.el.querySelectorAll('input, textarea');
for(var i = 0; i < inputs.length; i++) {
inputs[i].blur && inputs[i].blur();
if(this.unfocusOnHide) {
var inputs = this.el.querySelectorAll('input, textarea');
for(var i = 0; i < inputs.length; i++) {
inputs[i].blur && inputs[i].blur();
}
}
}
});