在服务器章节中把原来的管道删除了,现在搜索无效
来源:8-6 本章实战下

ABrandon
2017-08-02
请问要如何修复?
写回答
2回答
-
stock.service.ts
getStocks(name?:string): Observable<Stock[]> {
let url='/api/stock';
if(name){
url=url+'?name='+name;
}
return this.http.get(url).map(res=>res.json());
}stock-manager.component.ts
ngOnInit() {
this.stocks = this.stockService.getStocks();
this.nameFilter.valueChanges
.debounceTime(500)
.subscribe((value) => {
this.keyword = value;
this.stocks =this.stockService.getStocks(this.keyword);
});
}012017-08-03 -
adamtang
2017-08-20
<tr *ngFor="let stock of stocks | async | stockFilter: 'name':keyword">
保留原来的 stockFilter 管道
00
相似问题