A. Gladkiy
A. Gladkiy

Reputation: 3450

custom option template for select tag (angular 8.x)

I have Angular 8 app So html in my component:

<select class="form-control" id="theme" formControlName="theme" (change)="onChangeTheme($event)">
    <option *ngFor="let item of themeItems" [value]="item.id">
        <i class="fa fa-circle text-{{item.id}} pr-2"></i>
        <span>{{ item.text }}</span>
    </option>
</select>

And I want to populate custom template as above. ngx-select-dropdown supports this feature? Maybe I can do custom option template without any plugins? Or what's plugin the best match for me?

Upvotes: 1

Views: 2630

Answers (1)

wentjun
wentjun

Reputation: 42526

You may want to consider the ng-select library. It supports custom templates too. You may refer to the documentation for custom templates over here.

Upvotes: 2

Related Questions