The idea is that Fiddle was nice, but I found the implementation kind of dirty. So what can be done? Well, write an alternative dropdown directive on top of ui-bootstrap , of course!
Hope you find this helpful. It should be very easy to use.
Using
<dropdown is-button ng-model="vm.item" items="vm.items" callback="vm.callback(item)"> </dropdown>
So, you go into the ng-model , which contains the original selection, if any. The new value is set in the directive. In items , you have a collection of id-name pairs for selection and callback if you need it. If you specify the is-button attribute, you will get a is-button dropdown control.
Then the controller may look as follows.
controller
// Controller app.controller('Ctrl', function() { var vm = this; // items collection vm.items = [{ id: 0, name: 'London' },{ id: 1, name: 'Paris' },{ id: 2, name: 'Milan' }]; // current item vm.item = null; // vm.items[1]; // directive callback function vm.callback = function(item) { vm.fromCallback = 'User selected ' + angular.toJson(item); }; });
The logic for the dropdown directive is pretty simple, really.
JavaScript directive
// Dropdown directive app.directive('dropdown', function() { return { restrict: 'E', require: '^ngModel', scope: { ngModel: '=', // selection items: '=', // items to select from callback: '&' // callback }, link: function(scope, element, attrs) { element.on('click', function(event) { event.preventDefault(); }); scope.default = 'Please select item'; scope.isButton = 'isButton' in attrs; // selection changed handler scope.select = function(item) { scope.ngModel = item; if (scope.callback) { scope.callback({ item: item }); } }; }, templateUrl: 'dropdown-template.html' }; });
HTML Directive Template
<div class="btn-group" dropdown> <button ng-if="isButton" type="button" class="btn btn-primary" ng-bind="ngModel.name || default"> </button> <button ng-if="isButton" type="button" class="btn btn-primary dropdown-toggle" dropdown-toggle> <span class="caret"></span> </button> <a ng-if="!isButton" class="dropdown-toggle" dropdown-toggle href ng-bind="ngModel.name || default"> </a> <span ng-if="!isButton" class="caret"></span> <ul class="dropdown-menu" role="menu"> <li ng-repeat="item in items"> <a href="#" ng-bind="item.name" ng-click="select(item)"></a> </li> </ul> </div>
Here is the appearance of the original implementation. In addition to the provided sample, you will return the entire object, not just the id .

The related Plunker is here
http://plnkr.co/edit/bLWabx using angularjs 1.4.0-beta.3 and ui-bootstrap 0.12.0.