If you want to update the route when clicking an option in a bootstrap dropdown menu, you can listen for the route change event:
For example, if you have a link that opens a tooltip:
<a class="dropdown-toggle">
Click me for a dropdown, yo!
</a>
<ul class="dropdown-menu">
<li ng-repeat="choice in items" class="ng-scope">
<a class="ng-binding">The first choice!</a>
</li><li ng-repeat="choice in items" class="ng-scope">
<a class="ng-binding">And another choice for you.</a>
</li><li ng-repeat="choice in items" class="ng-scope">
<a class="ng-binding">but wait! A third!</a>
</li>
</ul>;
$scope.$on('$routeUpdate', function(scope, next, current) {
$('html').trigger('click');
});
The method above will work, but continuously selecting the html element on every route change can cause reflow. It's better to create a directive for this purpose, as shown below:
<html hide-dropdown>
angular.module('App', []).
directive('hideDropdown', function() {
return {
restrict: 'A',
link: function(scope, element) {
scope.$on('$routeUpdate', function(scope, next, current) {
element.trigger('click');
});
}
}
});