I have the parent user model like below:
user.ts
export class User {
employeeModel: employee = new Employee();
}
and I have a child model named employee.ts
export class Employeee {
name: string ;
age: string ;
position: string ;
}
In my component.ts I instantiate the parent model like:
model: User = new User();
And in my template:
<input type="text" [(ngModel)]="model.employeeModel.name">
Using that codes I get :
Cannot read property 'name' of undefined.
What is wrong with my codes?