I have 3 components. The 'Parent', 'Child 1' & 'Child 2'. On the load of the Parent component, I create a Model inside the 'Parent' and want to pass that Model to the child components, which then binds to the model and updates the parent Model.
Example:
Model:
export interface ITemplateModel {
id: string;
name: string;
lastModified: Date;
status: string;
templateHistory: string;
}
'Parent':
templateModel = ITemplateModel();
From this point in the Parent HTML I'm unsure if this is right but shows the idea.
'Parent HTML':
<app-child1 [(ngModel)]='templateModel'></app-child1>
<app-child2 [(ngModel)]='templateModel'></app-child2>
'Child1':
{{templateModel.name}}
'Child2':
<input [(ngModel)]="templateModel.status">