javascript - how to check the two check box simultaneously in x-editable using angular js -


hi want check check box if user select view check box should select view checkbox. if user select edit checkbox should select both view , edit checkbox simulataneously. here plunker.

<td ng-click="profileform.$show()" align="center">     <div>         <span e-ng-change="applyhighlight($data)"               editable-checkbox="manage_rolesui.view"               e-form="rowform"               ng-click="profileform.$show();">             <input type="checkbox"                    ng-model="manage_rolesui.view"                    width="20"/>         </span>     </div> </td> <td ng-click="profileform.$show()" align="center">     <span e-ng-change="applyhighlight($data)"           ng-checked="manage_rolesui.edit"           editable-checkbox="manage_rolesui.edit"           e-form="rowform"           ng-click="profileform.$show()">         <input type="checkbox"                ng-model="manage_rolesui.edit"                width="20"/>     </span> </td> 

you can use ngchecked angular directive automatically check view when edit checked way :

<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" /> 

checkout official ngcheck documentation more

or using controller

html

<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> 

controller

angular.module('app', []);  angular.module('app') .controller('examplecontroller', ['$scope', function($scope) {     $scope.autocheckview = function() {         $scope.manage_rolesui.view = ($scope.manage_rolesui.edit === true)     } }]); 

running example: https://plnkr.co/edit/y79wezief0bndhah4hdf?p=preview


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -