I have this Model-class.
export class Drivefunction{
public Injection: Injection;
public df_uid_machine_injsiz:string;
public Motor_Cable_IEC: Motor_cable;
...
And in my display.component.ts I have this function which fills my Drivefunction[]
fillDrivefunctions(){
this.machineService.getDrivefunctions(this.injectionID)
.subscribe((df:Drivefunction[])=> {
this.drivefunctions = df;
console.log(this.drivefunctions)
});
}
As you see I try a console.log to see if the json Objects a properly filled
all Objects and nested Objects are filled!
and in my HTML I have a ngFor with my drivefunction[] I can access properties like strings but get "cannot read property of undefined" if i try to access an nested object even if it's correctly filled.
Do I have to "extra" subscribe this nested objects?
my HTML:
<ion-list *ngFor="let drivefunction of this.drivefunctions; ">
<ion-item>
<ion-label>{{drivefunction.Injection.inj_uid_machine_injsiz}}</ion-label>
</ion-item>
</ion-list>

{{drivefunction.Injection?.inj_uid_machine_injsiz}}use the?operator. If Injection isn't populated it won't try to access inj_uid_machine_injsiz. you also don't need thethisin the html.