nie*_*ber 2 checkbox angularjs
为什么angular和checkbox模型没有绑定到checked ="checked".角度加载后,复选框将取消设置.例如:http://jsfiddle.net/5CZ74/2/
<div ng-app>
<form>
<input type="checkbox" ng-model="redirect" checked="checked">
<input type="text" ng-disabled="redirect==false">
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
当我的表单加载时,我根据服务器实体在服务器上启用或禁用它.如何使角度模型正确绑定到此值以启用或禁用输入文本字段.
谢谢.
你没有redirect在你的模型中定义任何地方,所以它是未定义的,因此是假的.这就是未选中复选框的原因.如果要检查,则需要添加redirect到模型并将其设置为true.你需要一个控制器并执行此操作:
$scope.redirect = true;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5533 次 |
| 最近记录: |