【发布时间】:2019-05-07 06:40:22
【问题描述】:
我有下面的复选框:-
<input type="checkbox" ng-click="toggleShowOtherUserConfiguration()"
ng-model="showOtherUserConfiguration"
name="ShowOtherUserConfiguration"
value="showOtherUserConfiguration" />
在 app.controller 中我设置了:-
$scope.showOtherUserConfiguration = false;
因此,当页面加载时,该复选框将始终保持 false。
但是发生了什么:-
页面加载时复选框处于未选中状态,此时$scope.showOtherUserConfiguration的值为false。
当复选框被选中时,它的值仍然是false。
当 Checkbox 状态从选中变为未选中时,
$scope.showOtherUserConfiguration 值变为true。
请指导我如何在未选中时保持false 和选中时保持true?
注意:- 除了更改 $scope.showOtherUserConfiguration 值之外,不会更改 toggleShowOtherUserConfiguration() 函数中的任何内容
【问题讨论】:
标签: javascript .net angularjs checkbox