嗨,当开关关闭时,标签应为灰色,如标签应禁用,如果打开则标签应启用
这里的小提琴:http : //jsfiddle.net/dgj7s5sk/8/
<label>check1</label>
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch"
checked="checked" />
<label class="onoffswitch-label" for="myonoffswitch"> <span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<label>check2</label>
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch2" />
<label class="onoffswitch-label" for="myonoffswitch2"> <span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
在这个问题上请我。谢谢
这是更新的小提琴与解决方案。
在您的示例中,您没有将代码声明为有角度的应用程序。
我做了什么:
<div ng-app>
第一行。ng-model
为输入switches.switch1
和定义switches.switch2
。.disabled-class { color:gray; }
<label ng-class="(switches.switch1)?'':'disabled-class'">check1</label>
<label ng-class="(switches.switch2)?'':'disabled-class'">check2</label>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句