mirror of https://github.com/moparisthebest/mail
Merge pull request #160 from whiteout-io/dev/WO-710
Close dropdown after selection has been made
This commit is contained in:
commit
eb3a266725
|
@ -117,7 +117,13 @@ ngModule.directive('woDropdown', function($document, $timeout) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elm.on('touchstart click', toggle);
|
elm.on('touchstart click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
toggle();
|
||||||
|
});
|
||||||
|
|
||||||
|
// close if user clicks button in dropdown list
|
||||||
|
dropdown.on('touchstart.woDropdown click.woDropdown', 'button', disappear);
|
||||||
|
|
||||||
// close if user clicks outside of dropdown and elm
|
// close if user clicks outside of dropdown and elm
|
||||||
$document.on('touchstart.woDropdown click.woDropdown', function(e) {
|
$document.on('touchstart.woDropdown click.woDropdown', function(e) {
|
||||||
|
@ -132,6 +138,7 @@ ngModule.directive('woDropdown', function($document, $timeout) {
|
||||||
// remove event listener on document
|
// remove event listener on document
|
||||||
scope.$on('$destroy', function() {
|
scope.$on('$destroy', function() {
|
||||||
$document.off('touchstart.woDropdown click.woDropdown');
|
$document.off('touchstart.woDropdown click.woDropdown');
|
||||||
|
dropdown.off('touchstart.woDropdown click.woDropdown');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue