I’m working with an Angular project. In a certain component I have this in my html file (code snippet):
<mat-slide-toggle #powerswitch
in the component’s ts file I can refer to this element like so and programmatically set it, all works fine (code snippet):
@ViewChild("powerswitch") PowerSwitch: any;
this.PowerSwitch._checked = true
at the moment PowerSwitch is defined as being of type any. How can I define it as being of type MatSlideToggle?
Just doing this is not enough (as compiler cannot find name MatSlideToggle):
@ViewChild("powerswitch") PowerSwitch: MatSlideToggle;
Would make the code nicer to debug as one could see the type of the variable at coding time.
Thanks.