I've been attempting to incorporate this code to make an API call for an image, but unfortunately, I haven't been successful:
<kit-general-16 [isNew]="product.isNew" [isFavorite]="product.isFavorite" [image]="mainImage(product.productImage)"
[name]="product.title" [price]="product.price" [oldPrice]="product.oldPrice" routerLink="../edit-product/{{product.id}}"></kit-general-16>
</div>
Component:
mainImage(productImage: number) {
this.productService.getProductImage(productImage);
}
Service:
getProductImage(imageId) {
return this.http.get<any>(environment.apiKey + '/engine/product/files/' + imageId)
}
When I implement it like this:
<div class="col-xl-4 col-lg-6" *ngFor="let product of products">
<kit-general-16 [isNew]="product.isNew" [isFavorite]="product.isFavorite" image="http://123.123.122.1:8090/engine/product/files/{{product.productImage}}"
[name]="product.title" [price]="product.price" [oldPrice]="product.oldPrice" routerLink="../edit-product/{{product.id}}"></kit-general-16>
</div>
Everything works as expected. Can you pinpoint where I might be going wrong?