I'm encountering an issue with an array of objects that appear as non-null in debug mode, but are showing up as undefined when trying to access them. Here's a more detailed explanation:
Here's the code snippet:
export interface ICollectPoint {
name: string,
shortName: string,
street: string,
buildingNumber: string,
apartmentNumber: string,
zipCode: string,
city: string
}
collectPoints: ICollectPoint[] = [];
this.collectPoints = [...this.logisticMethod.collectPoints]; // [{...}, {...}, {...}] - array with some objects - ICollectPoint { name, shortname }
const a = this.collectPoints[0].name
a = undefined
Can anyone offer assistance with this problem?
EDIT:
The code is within a component using changeDetection: ChangeDetectionStrategy.OnPush and I'm initializing this on ngOnInit()