I want to get native host element of the mat-checkbox
so I can do itemCheckbox.click()
. Now, itemCheckbox
is a MatCheckbox
. Can I get reference to the native element directly in the template?
<mat-checkbox
#itemCheckbox
(click)="$event.stopPropagation()"
(change)="$event ? selection.toggle(row) : null"
[checked]="selection.isSelected(row)">
</mat-checkbox>
ideally I would imagine something like this
<our-component #item="ElementRef"></our-component>
PS. this is generic question. I know I can itemCheckbox.toggle()
but the point is to get native element reference of the component in general. Also, I know I can @ViewChild
given component and get native element from there, but that is not the point.