Merge pull request #160 from whiteout-io/dev/WO-710

Close dropdown after selection has been made
This commit is contained in:
Tankred Hase 2014-11-10 13:58:52 +01:00
commit eb3a266725
1 changed files with 8 additions and 1 deletions

View File

@ -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
$document.on('touchstart.woDropdown click.woDropdown', function(e) {
@ -132,6 +138,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');
});
};
});