I have a component which is using OnPush
change detection.
In this component I have a FormArray
(inside of a FormGroup
).
I have two buttons, which add(push
) or remove(removeAt
) FormGroup
in FormArray
.
I expect because of the OnPush
change detection the changes are not visible (there is no change in the root FormGroup
reference)
However the component is detecting the changes perfectly.
I find a similar example (StackBlitz) where the changeDetection called manually, but when I remove that part of the code, it is still working fine.
I checked the Angular source and my guess is that the updateValueAndValidity
function call is doing the change detection, also this StackOverflow comment confirms it.
So can somebody explain how it is working exactly?
I wouldn't like to break my application in the future after an Angular update.
Thanks in advance!