1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-29 20:32:15 -05:00

Close dropdown after selection has been made

This commit is contained in:
Mario Volke 2014-11-06 17:34:59 +01:00
parent 8cc84ef8c6
commit fc66df8894

View File

@ -119,6 +119,9 @@ ngModule.directive('woDropdown', function($document, $timeout) {
elm.on('touchstart click', toggle); elm.on('touchstart click', 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) {
var t = angular.element(e.target); var t = angular.element(e.target);
@ -132,6 +135,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');
}); });
}; };
}); });