为什么 Angular 的 this.http.subscribe 主体中的 this 引用当前组件,而 React 或 Node 的嵌套异步回调中的 this 引用当前组件http请求本身?我该怎么做才能实现 Angular 图案?
最佳答案
要实现 Angular 模式,您可以在订阅之前添加 that = this;
(在方法主体中)。然后在订阅中引用它。
关于javascript - Angular 异步调用与 react 和 Node 异步调用中的“this”引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51797186/