使用Angularjs根据值选择复选框
16lz
2021-01-22
How do i check checkbox which has value of for example 5 with angularjs.
如何勾选复选框,它的值为例5。
I am getting JSON with all values of checkbox that needs to be checked , but i cant find anywhere how to automaticaly check checkbox with value of , with angular js.
我得到的JSON是需要检查的复选框的所有值,但是我找不到任何地方可以用角js自动选中值为的复选框。
2 个解决方案
#1
2
You can use the ngChecked directive for checking and unchecking a checkbox
您可以使用ngChecked指令来检查和取消检查复选框
Also if you want for example to set a checkbox to checked when the value is 5:
同样,如果你想设置一个复选框,当值是5的时候:
<input type="checkbox" ng-model="checkbox_model" ng-checked="data.value=='5'"/>
更多相关文章
- $ postLink的角度组件/指令运行得太早
- 等待执行所有ajax回调的最佳解决方案
- element.replaceWith在自定义指令的链接中仅在第一次调用时工作
- 【问题解决方案】ImportError: No module named 'pygal'
- Python 黏包及黏包解决方案
- Mac下MySQL-python安装及EnvironmentError: mysql_config not fo
- Python 2.6.2中的ElementTree处理指令支持?
- 无法安装ndg-httpsclient或者我的解决方案错误
- 通过指令“ps -l”查看进程信息