Encountered an issue with Angular 2+ related to loading a component, navigating to another route, and then reloading the component.
The code below loads an array that is then displayed using ngFor
.
this.sub = this.subjectsService.getAllSubjects().subscribe(subjects => {
this.subjects = subjects;
});
Adding an item during the initial load works correctly. However, upon navigating to a different component and returning back, any added items do not appear in the list.
I verified that the array is reset within the subscribe function, but it seems that Angular is not updating the HTML content. Any insights into why this behavior occurs?