Unsubscribe An Observable: In Angular applications, it's always recommended to unsubscribe the observables to gain benefits like: Avoids Memory Leaks Aborting HTTP requests to avoid unwanted calls. So in this demo, we will understand the case studies to unsubscribe an observable. Memory Leaks: Now let's implement observables code with memory leaks. So first let's create a service like 'test.service.ts' inside of initialize the 'BehaviourSubject' as below. services/test.service.ts: import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; @Injectable({ providedIn: 'root', }) export class TestService { randNumberSub: BehaviorSubject<number> = new BehaviorSubject<number>( Math.random() ); } (Line: 8-10) Initialized 'BehaviorSubject' of type 'number'. Now let's create components like 'sample1.component.ts' and 'sample2.component.ts' these will c