I am using @ngneat/until-destroy
this npm package to auto unsubscribe observables. I have used checkProperties: true
to auto unsubscribe observables.
But, I am not getting how to test it. Whether observable is getting unsubscribed or not?
My question is simple. Does this code work or do I have to use pipe like this before subscription
.pipe(untilDestroyed(this))
Thank you in advance
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
@UntilDestroy({ checkProperties: true })
@Component({
selector: 'app-view-all-purchase',
templateUrl: './view-all-purchase.component.html',
styleUrls: ['./view-all-purchase.component.scss']
})
export class ViewAllPurchaseComponent implements OnInit, OnDestroy {
ngOnInit() {
this.subscibe1 = this.vendorService.five_vendors().subscribe(data => {
if(data){
console.log(data)
this.vendor_list = data
}})
}
ngOnDestroy() {
}
}
ngOnDestroy()
, they'll stay. The ones that make http requests usingHttpClient
do not need to be unsubscribed as they are automatically unsubscribed when the request has finished. – Diallage