有对象的Angular UI select2数组有可能吗?

Jak*_*har 2 javascript angularjs jquery-select2 angular-ui

有没有一种简单的方法可以将选项作为数组中的对象?如下:

$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>
Run Code Online (Sandbox Code Playgroud)

或者我完全错了?

Pro*_*ser 6

看看这个我放在一起的演示:http://plnkr.co/edit/gist:4279651?p = preview

如果您希望所选项目成为对象使用 <input>

该演示向您展示了uiSelect2的4种不同方式