类型'OperatorFunction <Product [],ParamMap>'上不存在属性'subscribe'

时间:2019-09-28 04:54:59

标签: angular

constructor(productService: ProductService, categoryService: CategoryService, route:ActivatedRoute) {
    productService.getAll().snapshotChanges().pipe(switchMap((products:Product[])=> {
      this.product = products;
      return route.queryParamMap;

    })
    .subscribe(params=>{
      this.category =  params.get('category');

      this.filteredProduct = (this.category) ?
      this.product.filter(p=>p.category === this.category) :
      this.product;

    })); 

错误TS2339:类型'OperatorFunction'上不存在属性'subscribe'。

26 .subscribe(params => {         ~~~~~~~~~

0 个答案:

没有答案