I want to access a template reference variable using @ViewChild while the element is inside an element with async pipe present as follows:
<ng-container *ngIf="productTemplates$ | async as templates; else loading">
<div class="row">
<mat-checkbox #selectAll (change)="toggleAllTemplates($event)">Select All</mat-checkbox>
</div>
</ng-container>
How can I safely access the #selectAll reference early in the lifecycle of the component (like in ngAfterViewInit) while it is not present until the API call for products is returned?