I use Angular 9 and modify a variable that I use in a template. But unfortunately my template does not get updated. Can anyone explain me what the typical approach is to let Angular know that something in my component changed?
projects: any[] = [];
ngAfterViewInit(): void {
this.actRoute.params.subscribe((params) => {
this.electronService.foo.bar(
.then((x) => {
var history = x.y();
history.on("begin", () => {
this.projects.push('foo');
});
history.execute();
});
});
}
foo.component.html
<ul>
<li *ngFor="let project of projects;">{{project}}</li>
</ul>