I am trying to display from html file images that are in a table in .ts.
Here is my table:
BHs = [
new Bh (1, "src/assets/img/photo_bonhommes/BH1.jpg"),
new Bh (2, "src/assets/img/photo_bonhommes/BH2.png"),
new Bh (3, "src/assets/img/photo_bonhommes/BH3.png"),
new Bh (4, "src/assets/img/photo_bonhommes/BH4.png"),
new Bh (5, "src/assets/img/photo_bonhommes/BH5.png"),
new Bh (6, "src/assets/img/photo_bonhommes/BH6.png"),
new Bh (7, "src/assets/img/photo_bonhommes/BH7.png"),
new Bh (8, "src/assets/img/photo_bonhommes/BH8.png"),
new Bh (9, "src/assets/img/photo_bonhommes/BH9.png"),
new Bh (10, "src/assets/img/photo_bonhommes/BH10.png"),
new Bh (11, "src/assets/img/photo_bonhommes/BH11.png"),
];
With the class :
export class Bh {
constructor(
id: number,
src: String,
){}
}
And here is my html line :
<img id="bh" routerLink="/" *ngFor="let bh of BHs" src="bh.src"/>
{{bh.src}}
I've seen people with the same problem, so I tried :
<img id="bh" routerLink="/" *ngFor="let bh of BHs" src="bh.src"/>
<img id="bh" routerLink="/" *ngFor="let bh of BHs" src="{bh.src}"/>
<div *ngFor="let bh of BHs">
<img id="bh" routerLink="/" [src]='bh.src'/>
</div>
But none worked..
So I am a bit lost, I could use some help?
Thank you very much !