joaoneto / angular-bootstrap-select

DEPRECATED DON'T USE - Directive to wrap bootstrap-select
105 stars 81 forks source link

Modified to work with "track by" #52

Open marianocarpentier opened 8 years ago

marianocarpentier commented 8 years ago

This change is in order to support the track by option into the ng-options when you have a complex object as option. So now, I can do this:

<select selectpicker class="fps" ng-model="selectedXxx" ng-options="f as f.value for f in xxx track by f.name">

having devined my model as:

$scope.selectedXxx = null;
$.each(data.xxx, function(el) {
      $scope.xxx.push({'name': el, 'value': data.xxx[el]});
});
$scope.selectedXxx = $scope.xxx[0];

I've changed just some lines in src/angular-bootstrap-select.js, but later compiled the directive with grunt and that replaced the other files. The change itself is really small.