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?
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?
Share Improve this question edited Mar 28, 2013 at 21:43 j0k 22.8k28 gold badges81 silver badges90 bronze badges asked Jan 15, 2013 at 10:44 Jakub KucharJakub Kuchar 1,6652 gold badges23 silver badges40 bronze badges1 Answer
Reset to default 5Checkout 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