【发布时间】:2018-08-30 14:37:18
【问题描述】:
我想返回一个可观察对象的子元素。
假设我有一个可以观察到人的 HttpClient:
export class People{
public Name: string;
}
以及一个将单个服务作为可观察的服务:
public get(id: number): Observable<People> {
return this.http.get<People>('http://localhost:8801/' + "people/" + id);
}
现在我想从我的 observable 中获取名称作为 observable:
public get(id: number): Observable<string>{
this.peopleService.get(id) .... ?
}
这是怎么做到的?
【问题讨论】:
标签: angular observable rxjs6