I have variable that can be null
, {}
.
if (this.data) {
this.postaddressForm.get('index_for').setValue(this.data.index_for);
this.postaddressForm.get('dopaddr_for').setValue(this.data.dopaddr_for);
this.postaddressForm.get('region_id').setValue(this.data.region_id);
this.postaddressForm.get('house_for').setValue(this.data.house_for);
this.postaddressForm.get('locality_for').setValue(this.data.locality_for);
this.postaddressForm.get('street_for').setValue(this.data.street_for);
}
Problem is that sometimes there is properties in object data
. How to check it?
So, if there is no street_for
it fails.