I have been working with the code below to select an item if it is present in the filters:
<div ng-repeat="category in categories.data" ng-model="div1">
<div ng-repeat="(key, value) in category" mg-model="div1.div2">
{{ key + ":"}}
<select id={{key}} class="my_select"
data-ng-model="CategoryOption"
data-ng-change="updateCategories()"
data-ui-select2="{}" multiple >
<option ng-repeat="c in value"
ng-selected="(filters[key].length>0) && (filters[key].indexOf(c.trim()) !== -1)" >
{{c.trim()}}</option>
</select>
</div>
</div>
However, I've encountered an issue where nothing is getting selected... I've considered using ng-model to filters.key, but this leads to a problem where selecting one element cancels out the selection in another select due to them being bound to the same model...
Given the code above, what is the best way to restore my selections when using select2 with multiple selection enabled?