<!-- Example of using a template variable, named "fruit" --> <ng-template [ngIf]="tableSettings.selection.selected.length > 0"> <button #fruit class="mat-button" (click)="callMethod(fruit)"> </button> </ng-template>