复选框中的 ng-model 似乎是一种方式

ng-model in checkbox seems one way

我有一个从模型更新的复选框,但是单击该复选框后模型没有更新。

在我的表格中:

<input type="checkbox"  ng-model="acceptEula"> I have read the EULA and I agree
<button type="submit" ng-click="pay()" translate>Proceed to Pay</button>
{{acceptEula}}

点击复选框,我可以看到 {{acceptEula}} 如何显示 true 或 false,它有效。

当我点击按钮时,我在 pay() 函数中进行了细分。 $scope.acceptEula 总是错误的。可能是什么问题?

抱歉,为了简化问题,问题没有详细说明。实际上,我在表格中使用了"ng-switch"。 最后我找到了问题:"This is a scope inheritance problem due to ng-switch creating it's own scope."。在 angularjs - ng-switch does not bind ng-model

中有很好的解释

解决方法是在模型中使用点,例如$scope.form.acceptEula