Reputation: 1665
Is there a easy way to have options as objects in array? Like following:
$scope.search.categories = [{id: '1',name: 'first'},{id: '2',name: 'last'}];
<select ui-select2 ng-model="search.categories" multiple style="width:300px" data-placeholder="select category">
<option ng-repeat="category in search.categories" value="{{category}}">{{category.name}}</option>
</select>
Or am I totally wrong?
Upvotes: 2
Views: 8205
Reputation: 4616
Checkout this demo I've put together: http://plnkr.co/edit/gist:4279651?p=preview
If you want the selected item to be an object use <input>
The demo shows you 4 different ways to do uiSelect2
Upvotes: 5