Answer the question
In order to leave comments, you need to log in
Angular2: how to parse JSON in background: url?
The task is as follows: there is a list of products generated by *ngFor.
Each product has an {{product.image}}
image. I get this image from a JSON file:
[
{
"title": "Product 1",
"price": "3000",
"image": "https://abcdefg/hij/klm.jpeg"
},
{
"title": "Product 2",
"price": "200",
"image": "https://bbbbnnnnn/ggghhh/kjk.jpeg"
}
]<ul>
<li *ngFor="let product of products">
<span class="product__image">
{{product.image}}
</span>
<span class="product__title">
{{product.title}}
<span>
<span class="product__price">
{{product.price}}
<span>
</li>
</ul>background-size: cover;for the corresponding block would suit me. imgand write styles for it in CSS, but imgbackground-size: cover;it will not be possible to write for it. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question