I have Input in component:
@Input() applicant: Applicant;
interface Applicant {
applicant: ApplicantItem,
representative: Representative
}
Template is:
<div *ngIf="applicant.representative.type></div>
Problem is if applicant
has no object representative
it falls.
How to set default value if there is no representative
?
Like this:
@Input() applicant: Applicant = <Applicant>{};
I need to have representative
with type
always.
Also how to avoid error here:
applicant.representative = adapt(applicant.representative);
Here applicant.representative
should be default object { representative: {type:
}}`