OPV*_*OPV 1 promise typescript angular-promise angular
现在在.then第一节我们所有的另一个承诺http请求:
.then(result => { this.service().then(data => {}); });
Run Code Online (Sandbox Code Playgroud)
这是使用链式承诺的正确方法吗?
几乎!你需要在函数中返回promise,如下所示:
.then(result => { return this.service().then(data => {}); });
Run Code Online (Sandbox Code Playgroud)
或者像这样:
.then(result => this.service().then(data => {}));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
101 次 |
| 最近记录: |