【发布时间】:2017-06-22 18:39:20
【问题描述】:
我们是否需要取消订阅 Observable?我们什么时候需要使用取消订阅?
我阅读了一篇关于使用 firebase.auth 检查用户登录状态的 angularfire2 文章。在代码的最后,他取消了 auth.subscribe 的订阅。 https://javebratt.com/angularfire2-email-auth/(请参阅 app.component.ts)。
我真的很困惑,因为我认为 Observable 在完成或出错后会自行“取消订阅”。
Do we need to unsubscribe from observable that completes/errors-out? 和 Do you need to unsubscribe from Angular 2 http calls to prevent memory leak?
【问题讨论】:
标签: rxjs5 angularfire2