mercredi 8 août 2018

checkbox change issue with model value in edge browser

In my angular application i have a checkbox input . The issue is in IE,Edge browser

below is the checkbox code

 <label class="i-switch i-switch-lg pull-right">
         <input type="checkbox" name="mytoggle" [(ngModel)]="togglestatus" (click)="checkstatus($event)" />
        <i></i>

In my component i have code based on the status of the input below is the code

checkstatus(e){
    console.log(this.togglestatus);

    if (this.togglestatus) 
       console.log("toggle selected");           
    else 
       console.log("toggle not selected");
    }

this works fine in Chrome and Firefox browser but in edge and IE it works completely opposite.

In Chrome and Firefox i get console log for togglestatus as false but in IE and edge i get it as true.

How to resolve this

How to write the function that it works for Edge as well.

Please guide!

Thanks




Aucun commentaire:

Enregistrer un commentaire