Q. How do you unsubscribe from an Observable in Angular?

  • (A) By calling unsubscribe() on the subscription
  • (B) By setting Observable to null
  • (C) Angular unsubscribes automatically for all Observables
  • (D) By using ngOnInit hook
πŸ’¬ Discuss
βœ… Correct Answer: (A) By calling unsubscribe() on the subscription
Explanation: To avoid memory leaks, unsubscribe manually or use AsyncPipe.
Explanation by: Mr. Dubey
To avoid memory leaks, unsubscribe manually or use AsyncPipe.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
68
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
90%
Success Rate