Eitan Jacobs
Eitan Jacobs

Reputation: 5

Getting image from url located in JSON

I need to extract the url and to show it as a pictures:

How it looks from json:

how it looks from json

My html:

<ul>
  <li *ngFor="let product of store.Products">

    <p>Product ProductImage: {{ product.ProductImage }}</p>
    <p>Product Price: {{ product.Price }}</p>

  </li>
</ul>

Can I do it with pipe?

Upvotes: 0

Views: 48

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222542

i see a space in the json you provided, you need

<p>Product ProductImage: {{ product["Product ProductImage"] }}</p>
<p>Product Price: {{ product.Price }}</p>

you need to replace with image tag if you want to see an image

  <p><img [src]="product["Product ProductImage"]" /></p>
  <p>Product Price: {{ product.Price }}</p>

Upvotes: 1

Related Questions