Using angularjs here.
I am using ui-select for allowing the user to select multiple values as:
<div class="form-group" ng-repeat="(name, data) in usersets" ng-class="{ 'has-error': form[inputName + $index].$invalid && submitted }">
<ui-select name="{{inputName + $index}}" class="btn m-grid-col-md-3" ng-model="data.value" theme="bootstrap">
<ui-select-match placeholder="data">{{data.value}}</ui-select-match>
<ui-select-choices repeat="data in data.userValue | filter: $select.search track by $index">
<div ng-bind-html="data"></div>
</ui-select-choices>
</ui-select>
</div>
I have used the below line to bind the UI select to an array so that it can show all set of options when user starts to type in it.
<ui-select-choices repeat="data in data.userValue | filter: $select.search track by $index">
My issue is because some changes data.userValue above is not returning an array but just a single string value.
If I try to use the same code above I get error on console as:
[ui.select:items] Expected an array but got 'myString'
'myString' is the string returned from data.userValue
Could anyone point me as to what changes do I need to make above to make it accept a single string instead of an array.
Thanks
data.userValue? If it's a comma-delimited list (or something similar) you could easily convert it to an array in your controller and use the array instead.