KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have been trying to get my angular ui select2 directive to initialize and have been unable to get it to work with option groups. The Code: function testCtrl1($scope) { $scope.selectedOptions = ['1']; $scope.categories = [ {label: 'cat1', options: [{desc: 'one', value: 1}]}, {label: 'cat2', options: [{desc: 'two', value: 2}]} ]; } The HTML: <select multiple ui-select2 ng-model="selectedOptions" style="width: 300px"> <optgroup ng-repeat="category in categories" label="{{category.label}}"> <option ng-repeat="option in category.options" value="{{option.value}}">{{option.desc}} - {{option.value}}</option> </optgroup> </select> The Fiddle: I created the following jsfiddle . While doing so I notice that it would initialize correctly if I included a second select2 directive that didn't include the option groups (weird). I notice some other odd behavior when including the second select2 but I am not too concerned about it since my goal is just to get testCtrl1 working.
Tags (comma-separated)
Save Edits
Cancel