Yes Yes. Please note that you do not need to unsubscribe from http calls because they automatically terminate themselves.
You must unsubscribe to prevent memory leaks and avoid unexpected side effects in your application.
, , , . , , valueChanges - 2 , , .
.
RxJS , takeUntil - , , :)
:
private destroy$ = new Subject();
, , :
ngOnDestroy(){
this.destroy$.next();
}
, :
this.someInput.valueChanges
.debounceTime(1000)
.distinctUntilChanged()
.takeUntil(this.destroy$)
.subscribe (newValue => {
, , , .
, , , ngFor, , valueChanges (, ). ngOnDestroy . takeUntil:)
( RxJS Google), takeUntil, /.