I am trying to use ng-template for a html which is a separate component ,and I am trying to use its reference in other html.. Is it possible? If so I have tried the below ways and would like to understand what is that I am going wrong with?
ng-template.html
<ng-template #sample1>
<p>ng template content</p>
</ng-template>
display-template.html
<div *ngIf="found;">
<ng-container *ngTemplateOutlet="sample1"></ng-container>
</div>
DisplayTemplateComponent.ts
export class DisplayTemplateComponent {
@ViewChild('sample1', {static: false}) sample1: ElementRef;
found = true;
}