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 => { ~~~~~~~~~