仅贴出关键代码段
- let observableBatch = [];
- for (let item in this.facetFields) {
- observableBatch.push(this._searchService.filterTree(searchId,item).map(res => res.json()));
- }
- Observable.forkJoin(observableBatch).subscribe(res=> {
- for (let item of res) {
- //需要遍历树数组结果集
- } });
- }
- 异步请求队列获得结果集是个数组,所以需要循环处理结果集。