从Firestore过滤滤垫滑块

时间:2019-07-16 20:16:10

标签: angular google-cloud-firestore angular-material2

我正在尝试使用Angular Material的mat-slider为存储在Firestore中的数据创建一个过滤器。但是我不能传递值参数。服务中的功能我没有问题。

我认为我坚持使用changengModel

刷卡时出现以下错误

  

错误:错误的所有意图[[objeto Objeto]'。索洛塞   允许矩阵可迭代的

service.ts

getPaquetesCustom(precioValor: number) {
  const paquetes = this.afs.collection('paquetes', ref => ref
  .where('precio', '<=', precioValor)
  ).snapshotChanges().pipe(
    map(actions => actions.map(a => {
      const data = a.payload.doc.data() as Paquete;
      const id = a.payload.doc.id;
      return { id, ...data };
    }))
  );
  return paquetes;
}

component.ts

paquetes: any;
value: number;

filtrarPaquetes(valor) {
  this.paquetes = this.fs.getPaquetesCustom(valor);
}

component.html

<mat-slider class="w-100" min="13" max="595" step="10" thumbLabel tickInterval="10" [(ngModel)]="value" (change)="filtrarPaquetes(value)"></mat-slider>

0 个答案:

没有答案