边缘浏览器中模型值的复选框更改问题
checkbox change issue with model value in edge browser
在我的 angular 应用程序中,我有一个复选框输入。
问题出在 IE,Edge 浏览器
下面是复选框代码
<label class="i-switch i-switch-lg pull-right">
<input type="checkbox" name="mytoggle" [(ngModel)]="togglestatus" (click)="checkstatus($event)" />
<i></i>
在我的组件中,我有基于输入状态的代码
下面是代码
checkstatus(e){
console.log(this.togglestatus);
if (this.togglestatus)
console.log("toggle selected");
else
console.log("toggle not selected");
}
这在 Chrome 和 Firefox 浏览器中工作正常,但在 edge 和 IE 中工作完全相反。
在 Chrome 和 Firefox 中,我得到 togglestatus 的控制台日志作为错误
但在 IE 和 edge 中我得到它作为 true.
如何解决这个问题
如何编写适用于 Edge 的函数。
请多指教!
谢谢
使用change
代替click
<label class="i-switch i-switch-lg pull-right">
<input type="checkbox" name="mytoggle" [(ngModel)]="togglestatus" (change)="checkstatus($event)" />
</label>
在我的 angular 应用程序中,我有一个复选框输入。 问题出在 IE,Edge 浏览器
下面是复选框代码
<label class="i-switch i-switch-lg pull-right">
<input type="checkbox" name="mytoggle" [(ngModel)]="togglestatus" (click)="checkstatus($event)" />
<i></i>
在我的组件中,我有基于输入状态的代码 下面是代码
checkstatus(e){
console.log(this.togglestatus);
if (this.togglestatus)
console.log("toggle selected");
else
console.log("toggle not selected");
}
这在 Chrome 和 Firefox 浏览器中工作正常,但在 edge 和 IE 中工作完全相反。
在 Chrome 和 Firefox 中,我得到 togglestatus 的控制台日志作为错误 但在 IE 和 edge 中我得到它作为 true.
如何解决这个问题
如何编写适用于 Edge 的函数。
请多指教!
谢谢
使用change
代替click
<label class="i-switch i-switch-lg pull-right">
<input type="checkbox" name="mytoggle" [(ngModel)]="togglestatus" (change)="checkstatus($event)" />
</label>