11175

Question:
In assets folder, I already have images, but name will come from backend
name like foo
we have variable in component, say public imageName
and foo will bind to this varialbe dynamically.
So in html i want to display this image I tried below code
<img [src]="/assets/{{imageName}}'.jpg'" class="img-thumbnail" alt="{{imageName}}" width="304" height="236">
but i m unabel to see the image, i am getting some html errors
Answer1:Try this syntax:
<img [src]="'assets/'+imageName+'.jpg'" class="img-thumbnail" alt="{{imageName}}" width="304" height="236">