【发布时间】:2018-07-06 15:27:02
【问题描述】:
我有一定的检查复选框的条件,我正在使用条件运算符的 ng-checked 中的功能逻辑。 这对我来说很好。 问题是,在提交模型值时,我没有得到 ng-checked 值。 如何也修改经过 ng 检查的值?希望我能得到答案。 这是我试过的:
<input type="checkbox" id="View" ng-model="module.View"
ng-checked="((findViewCheckBoxIsChecked(module)) || (module.ViewAll))"
ng-disabled="disableCheckBox(module)">
$scope.findViewCheckBoxIsChecked = function (module) {
if (module.View || module.ViewAll || module.Name == 'x' && module.Add
|| module.Name == 'x' && module.Edit
|| module.Name == 'x' && module.Delete
|| module.Name == 'x' && module.Add
|| module.Name == 'y' && module.Edit
|| module.Name == 'y' && module.Delete
|| module.Name == 'z' && module.Add
|| module.Name == 'z' && module.Edit
|| module.Name == 'z' && module.Delete) {
return true;
}
else {
return false;
}
}
【问题讨论】:
-
我不认为我理解这个问题。另外,如果可能,请发布
findViewCheckBoxIsChecked的代码。 -
是的,我加了兄弟
-
你现在收到了吗?
-
嗯,我在那里看到了很多条件。老实说,我们应该在上下文中看到这一点,例如,当问题出现时,
module有什么价值?如果你能创建一个Minimal, Complete, and Verifiable example ... 那会很有帮助。 -
moudle 是模型对象兄弟。如果我单击一个复选框意味着另一个复选框也将被选中,如果其他代码。问题是第二个选中的复选框在提交后没有反映在模型对象中。这是我的问题兄弟。
标签: angularjs