admin管理员组文章数量:1387301
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
本文标签: javascriptAngular UI select2 array with objects is it possibleStack Overflow
版权声明:本文标题:javascript - Angular UI select2 array with objects is it possible? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744497410a2609114.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论