Reputation: 400
I'd like to display a structure like
parent
-child1
--childOfChild1
-child2
inside select options using angular.
Using lists or other elements works great but when using select2 the result is each option displays a single hyphen like - category
Example: http://jsfiddle.net/WhLCM/
Culprit:
<select class="input-medium" ui-select2 ng-model="category" type="text" >
<option ng-repeat="cat in categories" value="{{cat.name}}">
<span ng-repeat="a in cat.ancestors">-</span>
{{cat.name}}
</option>
</select>
Upvotes: 2
Views: 1728
Reputation: 1472
span
is not allowed inside option
element, so the inner ng-repeat
never kicks in. You need to try something different, for example this: http://jsfiddle.net/WhLCM/18/
Upvotes: 2