LVDM
LVDM

Reputation: 454

Angular2 loop through array within object

I got an object project which contains some properties and an array, when I try to loop trough it like this it's not working:

<img *ngFor="let image of {{project?.acf.images}}" src="{{image.image.url}}">

When I display it like this: {{project?.acf.images[0].image.url}}, it perfectly shows the url. Anything wrong with my syntax?

Upvotes: 2

Views: 91

Answers (1)

Stefan Svrkota
Stefan Svrkota

Reputation: 50623

Interpolation is not needed in NgFor directive:

<img *ngFor="let image of project?.acf.images" src="{{image.image.url}}">

Upvotes: 5

Related Questions