I have component, where I show data, got from back end.
Here is function for showing data
getData() {
this.propertyService.getPropertyForEdit(Number(this.activatedRoute.snapshot.params['id'])).subscribe(r => {
this.property = r;
this.tabTemplates = [
{ title: this.l('Addresses'), template: this.addressesTemplateRef },
{ title: this.l('Site'), template: this.siteTemplateRef}
];
this.propertiesToDisplay = [
{ displayName: this.l('PropertyTitle'), value: this.property.propertyTitle.name},
{ displayName: this.l('Landlord'), value: this.property.landlord.name},
{ displayName: this.l('Agent'), value: this.property.agent.name },
{ displayName: this.l('BuildingType'), value: this.property.buildingType.name }
];
});
}
In this row value: this.property.landlord.name}
value can be null.
So when it null, I have error
Cannot read property 'name' of undefined
How I can fix this?