0

考虑到以下代码段,如何使用 angularjs 让用户选择多个标签

标记

<input type="hidden" ui-select2="select2Options" ng-model="list_of_string" style="width:100%" />
                                <small>hint: start to type with  a</small>

角度范围

$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;
    }
}
4

1 回答 1

0

尝试将您的更改<input .../><select> </select>

喜欢

<select multiple ui-select2 ng-model="list_of_string" style="width: 100%">
    <option ng-repeat="option in data">{{option.text}}</option>
</select>
于 2014-07-23T13:04:29.980 回答