1

I have a component that shows a list of accounts. I would like to show not only the account number but also the currency with an icon or image of country flag.

This is my component:

<select name="drpAccounts" class="form-control"[(ngModel)]="accountSelected" (change)="handleChangedDrpAccount($event)">
    <option *ngFor="let account of accounts" [ngValue]="account">
        {{ account.formattedNumber }}
    </option>
</select>

I found many projects of libraries on github but I want something simple. Thanks in advance.

EDIT:

After some proofs with this code

<select name="drpAccounts" class="form-control" [(ngModel)]="accountSelected" (change)="handleChangedDrpAccount($event)">
    <option style="background-image:url(assets/img/country-flag.png);" *ngFor="let account of accounts" [ngValue]="account">
        {{ account.formattedNumber }}
    </option>
</select>

I realized that it works when I put the style in the select tag

<select style="background-image:url(assets/img/country-flag.png);" ... >

and that it's I don't want

enter image description here

JPocoata
  • 634
  • 1
  • 11
  • 24
  • posible duplicate [How to add a images in select list](https://stackoverflow.com/questions/2965971/how-to-add-a-images-in-select-list) – sixerss Jan 16 '18 at 15:25

1 Answers1

0

This has nothing to do with angular oder typescript. It's a html/css related topic. Maybe this helps:

How to add a images in select list

Ma Kobi
  • 888
  • 6
  • 21
  • 1
    I should have said it, I tried the solution from the link before asking, but it doesn't work. It works for an input tag but not for option... – JPocoata Jan 16 '18 at 15:35