I'm confused about how to get a property of an Angular element. I'm using Angular Material, and in the documentation they describe how mat-button-toggle
has a property called checked
that signals whether the button is checked or not. So in my head for an element like:
<mat-button-toggle id="100"> Button </mat-button-toggle>
I should be able to do a
let element = document.getElementById("100");
let checked = element.checked;
However, the checked
variable turns up as undefined
. Why? And how can I programmatically check if the button is checked?