我正在使用Angular 6 http客户端,我有一个我无法解释的行为 .
这就是我的意思:很多次我提出这样的请求:
this.http.post(
Globals.resetEndPoint + this.router.url.slice(7),
{ password: this.f.password.value, url: this.router.url.slice(7) },
{ reportProgress: true, observe: 'events' }
).subscribe((res) => {
console.log(res['body']);
}, (err) => {
console.log(err);
});
成功函数被触发多次而没有结果,直到它给出结果 .
大多数时候,我使用类似的东西
if (res['body']) { ... }
解决方法 .
如果我做错了或这是正常的,你能告诉我吗?