2

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>

1 Answer 1

2

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/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.