I have parent component A and a lot (20+) child components, all extending A and being located inside <ng-content></ng-content>. In component A I'm setting value of showContent variable in multiple places.
The problem is that I'm using *ngIf="showContent" in all child components. Because the child components' views are not updated when the value in A is changed I can either:
A) use Output + EventEmitter but I would not like to have
onValueChange(val: boolean) {
this.showContent = val;
}
in every child component (20+ times same code);
B) use async pipe. The problem is that I'm setting value in GET/POST subscriptions
this.httpDataHandler.get<...>(...).subscribe(response => {
// lots of stuff
showContent = true;
});
Is there any way to use async pipe and remove redundant code from all children?