我试图根据组件中数组的内容更新视图。但是数组已成功更新,但视图未更新。这是我的代码
products.ts
productsByCategory(cat) {
console.log(cat.CategoryID);
this._productsByCategories.getProductsByCategories(cat)
.subscribe(res =>{
this.Products = res;
console.log(res);
console.log(this.Products.length);
});
}
products.html
<ng-container *ngFor="let product of Products">
<ion-card class="products">
<img class="product-images" src="{{product.ThumbFilePath}}"/>
<ion-card-content>
<ion-card-title>
{{product.Title}}
</ion-card-title>
<p>
{{product.Subtitle}}<br>
{{product.ListPrice}} ETB <br>
</p>
<button ion-button block round>Buy Now</button>
</ion-card-content>
</ion-card>
</ng-container>