ionic 3视图未更新

时间:2018-12-08 08:33:03

标签: angular ionic3

我试图根据组件中数组的内容更新视图。但是数组已成功更新,但视图未更新。这是我的代码

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>

0 个答案:

没有答案