从列表中选择选项后打印过滤的数据

时间:2018-10-27 22:09:26

标签: angular angular4-forms

我使用价格pricelist过滤了我的数据  

this.myForm.get('filterProduct').valueChanges.subscribe(
        value => {
          data.Stores.forEach(filtered => {
             this.filtered=filtered.Products.filter(val => value.slice(1) >= val['Price']);
            this.p = filtered.Products; //Add to price filter.
            console.log(filtered);
            console.log(this.p);


          })`

这很好用,我想在选择价格后打印所有过滤的数据:data to print
HTML(没有其他打印方法)

<form [formGroup]="myForm">
<select name="Price" formControlName="filterProduct">
   <option value=a *ngFor="let k of priceFilter  | groupBy: 'Value' | keyvalue">
     <div>
  <ng-container *ngFor= "let i of k['value']">
     <span>{{i['DisplayText']}}</span>
  </ng-container>
  </div>
   </option>
   </select>

   <ul>
    <li *ngFor="let product of filtered.Products">
        <img src={{product.ProductImage}}>
        <p>store: {{ store.StoreName }}</p>
        <p>Product Price: {{ product.Price }}</p>
      <p>Product Title: {{ product.ProductTitle }}</p>

    </li>
  </ul>
   </form>

0 个答案:

没有答案