I'm trying to store data from api to string array in angular5 and use each of the strings as img src but i don't think i'm getting it right. I'm currently doing it this way:
component.ts
let allOther_images: string[] = [];
data.other_images.forEach(item => {
allOther_images.push(item.image);
console.log(allOther_images);
["http://web.apiendpoint.com/media/products/dhjsh_HA3PAf1.png"] //console output
})
component.html
<div class="other-images" style="padding: 20px">
<div class="item" *ngFor="let item of allOther_images">
<img [src]="item" alt="" style="height: 250px;">
<span class="remove-img">×</span>
</div>
</div>
With this even the image element does not show in console so I'm guessing I have the *ngFor quite wrong.
Can you spot where I have gone wrong?
letkeyword.