有没有办法让这个伪代码工作?
private letsSee(): Promise<any> {
return new Promise(resolve => {
this.someService.someValue.subscribe((nextValue) => {
resolve(nextValue);
});
});
}
答案 0 :(得分:1)
将Observable转换为Pormise:
private letsSee(): Promise<any> {
return this.someService.someValue.toPromise();
}