please check this i got this error.i am receiving on and off from server and change the button by the "on' ,"off" condition but its works but this error i got
setInterval(function(){
peopleData.btnState().subscribe(btnstate => {
ourthis.zone.run(() => {
var btni =<HTMLInputElement> document.getElementById("myonoffswitch");
if(btnstate == "off") {
btni.checked=true;
}
else if(btnstate== "on") {
btni.checked=false;
}
});
});
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked (click)="onoffButton()">
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
i run this code but i get this error TypeError: Cannot read property 'checked' of null so please help me
Aucun commentaire:
Enregistrer un commentaire