Why is the view not being updated when a variable changes within a subscribe?
I have this code:
example.component.ts
testVar
For me none of the above worked. However, ChangeDetectorRef did the trick.
From angular Docs where is how it is implemented:
class GiantList {
constructor(private ref: ChangeDetectorRef, public dataProvider: DataListProvider) {
ref.detach();
setInterval(() => { this.ref.detectChanges(); }, 5000);
}
}
https://angular.io/api/core/ChangeDetectorRef