Search code examples
angularjsng-optionsangularjs-ng-options

angluarjs ng-option with template inside


I want to create a dropdown select with text and an icon. My start point is this:

<select ng-change="actions.change()"
        ng-model="variant_id"
        ng-options='variant.id as variant.name for variant in variants'>
</select>

but in the instead of showing name, i want to put something like this:

<div>{{variant.name}} <span ng-show="variant.show">show!</span></div>

how can i do it in ng-options?


Solution

  • You can't put html inside option tag.

    But you can use it https://github.com/angular-ui/ui-select or other simmilar 'plugins'