I am facing an issue with a component where I have declared an input as follows:
@Input() isOverlay: boolean
The template html for this component looks like this:
<ng-template *ngIf="isOverlay" cdkConnectedOverlay [cdkConnectedOverlayOrigin]="trigger" [cdkConnectedOverlayOpen]="active">
<div class="context-menu__header">
<strong>{{ label }}</strong>
</div>
<ng-content></ng-content>
<div class="context-menu__footer"></div>
</ng-template>
<ng-container *ngIf="!isOverlay">
<div class="context-menu__header">
<strong>{{ label }}</strong>
</div>
<ng-content></ng-content>
<div class="context-menu__footer"></div>
</ng-container>
Although it works, the presence of two ng-content tags seems to be causing an issue. When I pass the boolean value as true and comment out the second ng-content tag, it works fine. But if I leave both ng-content tags, it doesn't work. Any idea why?