使用select2 AngularJS获取所选标签文本
考虑到以下代码段,如何使用angularjs获得用户选择的多个标记 标记使用select2 AngularJS获取所选标签文本,angularjs,tags,selected,ui-select2,Angularjs,Tags,Selected,Ui Select2,考虑到以下代码段,如何使用angularjs获得用户选择的多个标记 标记 <input type="hidden" ui-select2="select2Options" ng-model="list_of_string" style="width:100%" /> <small>hint: start to type with a</small> 尝试将您的更改为 像 {{option.t
<input type="hidden" ui-select2="select2Options" ng-model="list_of_string" style="width:100%" />
<small>hint: start to type with a</small>
尝试将您的
更改为
像
{{option.text}
您能提供小提琴或类似的代码吗?我会上传到plunkr上
$scope.list_of_string = [];
$scope.select2Options = {
data: function() {
api.categories().then(function(response) {
$scope.data = response;
});
return {'results': $scope.data};
},
'multiple': true,
formatResult: function(data) {
return data.text;
},
formatSelection: function(data) {
return data.text;
}
}
<select multiple ui-select2 ng-model="list_of_string" style="width: 100%">
<option ng-repeat="option in data">{{option.text}}</option>
</select>