结果总是“打开”。我想让它在打开和关闭时得到两个结果。
<label class="switch switch-3d switch-primary switch-success">
<input type="checkbox" (change)="isChangeLimitAccessToggle($event.target.value)" id="ifLimitAccess" class="switch-input">
<!-- [attr.disabled]="switchDisable?'':null" [checked]="switchEnable" -->
<span class="switch-label" data-on="Yes" data-off="No"></span>
<span class="switch-handle"></span>
</label>
最佳答案
只需使用checked 属性:
<input type="checkbox" (change)="isChangeLimitAccessToggle($event.target.checked ? 'on' : 'off')" id="ifLimitAccess" class="switch-input">
关于angular - 如何打开和关闭输入复选框(更改)事件值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51436812/