I have 2 components: parentComponent
and childComponent
. In parentComponent
I have a FormGroup
type value as parentForm
that is passed to childComponent
via @input
:
export class parentComponent {
...
parentForm: FormGroup;
....
}
export class childComponent {
...
@Input()
childForm :FormGroup; //The parentForm
....
}
when I run these codes everything is ok and my childComponent
recognize the childForm
which is an input value from parentComponent
but whenever I change some properties in parentForm
in parentComponent
the childComponent
is not able to be aware of these changes and when I debug my codes I see that the childComponent
holds old input value and the changes is not updated in childForm
in childComponent
. now I seek to find a way to pass the reference of parentForm
to solve my problem. because I think by this way any change in the parentForm
will inform childForm
immediately.
I do not know how it is possible. (the version of Angular is 5.0.1)