I am trying to implement PrimeNG's dropdown with images in front of option label, but the images are not displayed.
In the .ts file I have the options array like:
langOptions = [
{label: 'hungarian', value: 'hu', imgSrc: './assets/img/flags/flag_hu.svg'},
{label: 'english', value: 'en', imgSrc: './assets/img/flags/flag_en.svg'}
];
in the template:
<form [formGroup]="langChangeForm">
<p-dropdown [options]="langOptions" optionLabel="label" (change)="onChange($event.target.value)">
<ng-template let-country pTemplate="item">
<div>
<img [src]="country.imgSrc" />
<div>{{country.label | lang}}</div>
</div>
</ng-template>
</p-dropdown>
</form>
tried <img src="{{country.imgSrc}}" />
too, no success...
If I replace the property binding [src]="country.imgSrc"
with src="./assets/img/flags/flag_en.svg"
the image loads.
Any idea how to make this work? thanks!