With this example ( JS Bin of pure html select tag ) I can able to achieve the pure html select multiple.
But I am using the selectize plugin
https://selectize.github.io/selectize.js/
for dropdown multi-select and i am confused how to populate the already selected values.?
This is what i tried My HTML:
<div ng-repeat="item in items">
<select
multiple
class="selectSkill"
ng-model="item.storedArray"
ng-options="opt.skillId as opt.skillName for opt in skills"
></select>
</div>
My Client:
$scope.$selectSkill= $('.selectSkill').selectize({
valueField: 'skillId',
labelField: 'skillName',
searchField: 'skillName',
maxItems: 5,
placeholder:"Select Skill",
options: $scope.skills,
create: false,
sortField: {
field: 'skillName',
direction: 'asc'
}
});
$scope.selectizeControlSkills = $scope.$selectSkill[0].selectize;
I am loading selectize with class-based(selectSkill).
Without populate normal load is working but I'm trying to set values using selectize dynamically.
help is appriciated thank you.
My Demo data:
**$scope.skills**
**item.storedArray**


selectize.js, you shouldn't mix it withng-modelandng-optionsbecause the latter won't work. Here's a minimal working example based on your snippets - plnkr.co/edit/0JvCrB1QfaRMk3kFBcsf?p=preview