I am trying to create a multiselect dropdown using Bootstrap 3.0.2 and AngularJS 1.2. I can get the dropdown box to open and multiselection to work. However, what is not working is that when I click anywhere outside the menu it doesn't close. As of now, I am treating the "Filter Selections" button as a toggle to open and close the dropdown box, which isn't very user-friendly.
How can I make the dropdown box to close when I click outside the menu?
This is what I have so far:
<div class="btn-group" data-ng-class="{open: openDropDown}">
<button class="btn btn-default" type="button" data-ng-click="openDropDown=!openDropDown">Filter Selections<span class="caret"></span></button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu">
<li><a href="">Item #1<span class="glyphicon glyphicon-ok-sign pull-right"></span></a></li>
<li><a href="">Item #2<span class="glyphicon glyphicon-ok-sign pull-right"></span></a></li>
<li><a href="">Item #3<span class="glyphicon glyphicon-ok-sign pull-right"></span></a></li>
<li><a href="">Check All</a></li>
<li><a href="">Uncheck All</a></li>
</ul>
</div>
I know I need to somehow incorporate bootstrap's code: ".dropdown-backdrop" to close dropdown menus when clicking outside the menu.
Bootstrap 3 Dropdown Usage: http://getbootstrap.com/javascript/#dropdowns