angular - 我没有在 mergeMap 中使用 httpClient.get Observable 获取任何数据
问题描述
这就是我所做的
constructor(
private route: ActivatedRoute,
private pData: PDataService,
) {
}
ngOnInit() {
this.combine$ = combineLatest(
this.route.parent.params,
this.route.params,
).pipe(
map(([parent, child]) => {
return { parent, child };
}),
tap( val => {
// did something
),
mergeMap( val => this.pData.getCommentsData(val.parent['id'], val.child['id']))
).subscribe( val => console.log(val));
}
在 PDataService 中
getCommentsData(productId, reviewsId) {
return this.httpClient.get<any>( this.BASE_URL + '/api/products/' + productId + '/reviews/' + reviewsId + '/' );
}
但我没有通过console.log(val)从this.pData.getCommentsData(val.parent['id'], val.child['id']))
this.route.parent.params
此外,来自,
的route.eventthis.route.params
不工作,除非一开始。
路线事件应该始终有效。我编码错误吗?
解决方案
推荐阅读
- image - How to use another library in the tensorflow graph?
- html - HTML Standard for Head layout?
- angular - Angular 6 ActivatedRouteSnapshot Service Firebase
- angular - 404 手动刷新
- c - How is rustc able to compile source code from bash process substitution but gcc cannot?
- sql - 访问数据库以存储和创建不同版本的报告
- azure-service-fabric - 通过 Service Fabric 查询 Graph API 时,我没有获得所有扩展属性
- java - 使用 Metamodel Java 继承
- cocos2d-x - cocos2d spriteframe透明背景
- python - Why does loading the libc shared library have "'LibraryLoader' object is not callable" error?