- A BRIEF SUMMARY
Implementing an observable in my code, I strive for maintaining cleanliness and efficiency by utilizing the detectChanges() method to update *ngIf=
in the HTML.
- QUERY
Is there a way to invoke the detectChanges()
method within subscribe()
function as demonstrated in the following example?
Demonstration (does not work due to overload):
this.subscriptions.add(
this._hotelEffect
.getHotel()
.pipe(map(this.createHotel))
.subscribe(this._changes.detectChanges)
);
My current workaround:
this.subscriptions.add(
this._hotelEffect
.getHotel()
.pipe(
map((resp) => {
this.createHotel(resp);
this._changes.detectChanges();
})
)
.subscribe()
);