I am currently facing an issue with a parent component that consists of two templates. The first template simply displays data-bound text, while the second template contains a child component responsible for updating the data model. Both the parent and child components use ChangeDetectionStrategy.OnPush.
The problem arises when the data updates initiated from the child component's ngOnInit function are not being detected by the change detection mechanism in the parent component. This results in the parent component displaying the value set in the constructor of the child component, instead of the value set in the ngOnInit function.
I have explored various approaches, such as using markForCheck and @Output events in the child component, but these solutions did not work as expected due to the parent-child relationship being established through ng-template rather than direct component nesting.
I am seeking suggestions on the cleanest and most Angular OnPush-friendly approach to pass data from a ng-template created child component to its parent, while maintaining loose coupling between components and services.