Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用angular js在x-editable中同时选中这两个复选框_Javascript_Jquery_Angularjs_Mean Stack_X Editable - Fatal编程技术网

Javascript 如何使用angular js在x-editable中同时选中这两个复选框

Javascript 如何使用angular js在x-editable中同时选中这两个复选框,javascript,jquery,angularjs,mean-stack,x-editable,Javascript,Jquery,Angularjs,Mean Stack,X Editable,嗨,我想勾选该复选框,如果用户选中查看复选框,则应选中仅查看复选框。如果用户选择编辑复选框,则应同时选择查看和编辑复选框。这是一本书 您可以使用ngCheckedangular指令在以这种方式选中编辑时自动检查视图: <input type="checkbox" ng-model="Manage_Rolesui.View" width="20" /> <input type="checkbox" ng-model="Manage_Rolesui.Edit" ng-change

嗨,我想勾选该复选框,如果用户选中查看复选框,则应选中仅查看复选框。如果用户选择编辑复选框,则应同时选择查看和编辑复选框。这是一本书


您可以使用
ngChecked
angular指令在以这种方式选中编辑时自动检查视图:

<input type="checkbox" ng-model="Manage_Rolesui.View" width="20"  />
<input type="checkbox" ng-model="Manage_Rolesui.Edit" ng-change="Manage_Rolesui.View = (Manage_Rolesui.Edit === true)" width="20" />

运行示例:

您可以使用
ngChecked
angular指令在以这种方式选中编辑时自动检查视图:

<input type="checkbox" ng-model="Manage_Rolesui.View" width="20"  />
<input type="checkbox" ng-model="Manage_Rolesui.Edit" ng-change="Manage_Rolesui.View = (Manage_Rolesui.Edit === true)" width="20" />

运行示例:

是的,我考虑过这个解决方案,但它并不完全符合用户的要求。如果您取消选中
edit
,视图也会取消选中
edit
。好的,我已经更新了我的答案以满足您的需要。纯角度;)不要将这样的逻辑放到视图m8中。这是最简单的方法,但也可以使用控制器方法;)更新了我的答案,该死!你说得对!在我的帖子中,我从一个无控制器的解决方案开始,以一个非常接近你的代码结束!我们都应该得到一枚奖牌^^^是的,我考虑过这个解决方案,但这并不完全符合用户的要求。如果您取消选中
edit
,视图也会取消选中
edit
。好的,我已经更新了我的答案以满足您的需要。纯角度;)不要将这样的逻辑放到视图m8中。这是最简单的方法,但也可以使用控制器方法;)更新了我的答案,该死!你说得对!在我的帖子中,我从一个无控制器的解决方案开始,以一个非常接近你的代码结束!我们都应该得到一枚奖章^^
<div ng-controller="ExampleController">
    <label>View</label>
    <input type="checkbox" ng-model="Manage_Rolesui.View" width="20"  />
    <label>Edit</label>
    <input type="checkbox" ng-model="Manage_Rolesui.Edit" ng-change="autoCheckView()" width="20" />
 </div>
angular.module('app', []);

angular.module('app')
.controller('ExampleController', ['$scope', function($scope) {
    $scope.autoCheckView = function() {
        $scope.Manage_Rolesui.View = ($scope.Manage_Rolesui.Edit === true)
    }
}]);