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
1 changed files with 4 additions and 0 deletions

View File

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