I recently updated my version of angular using ng update
and when running ng lint
I am getting the error create is deprecated: use
Pretty simple
this.data$ = new Observable((observer: Observer) => {
observer.next();
observer.complete();
});
Or you can use just
this.data$ = of(this.model);
observableSubscription: Subscription;
Creating Custom Observable
const observer = new Observable((observer: Observer) => {
observer.next();
observer.error();
observer.complete();
});
Subscribing To Custom Observable
this.observableSubscription = observer.subscribe((data:any) => {
console.log(data);
})
Unsubscribing
this.observableSubscription.unsubscribe();