Recently, I encountered an issue where data from a nested array in a data response was not displaying properly in my component's view. Despite successfully pushing the data into the object programmatically and confirming that the for loop added the items to the existing array during the 'OnInit' lifecycle hook, the table in the view remained empty.
ngOnInit(): void {
this._data.getContacts().subscribe(data => this.addAsyncData(data));
}
addAsyncData(result){
for(let i =0; i < result.length; i++) {
this.people.push(result[i]);
}
}
This unexpected behavior led me to suspect that the issue might be related to lifecycle hooks.