2017-04-06 9 views
1

안녕하세요 사용자가보기 확인란을 선택하면보기 확인란 만 선택하면 확인란을 선택하고 싶습니다. 사용자가 편집 확인란을 선택하면보기 및 편집 확인란을 동시에 선택해야합니다. 다음은 plunker입니다. 편집이 선택 될 때각도 js를 사용하여 x 편집 가능한 동시에 두 확인란을 확인하는 방법

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

답변

0

자동보기를 확인하려면이 방법을 ngChecked 각 지시어를 사용할 수 있습니다

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

를 체크 아웃 Official ngCheck documentation for more

또는 컨트롤러

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> 

컨트롤러

angular.module('app', []); 

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

실행 예 : https://plnkr.co/edit/Y79wezief0bndhah4hdF?p=preview

+0

참으로,이 솔루션에 대해 생각하지만이 완전히 사용자의 요구 사항과 일치하지 않습니다. 'edit'를 선택하지 않으면 뷰는'unchecked'됩니다. – lin

+0

네, 필요에 맞게 답변을 업데이트했습니다. Pure Angular;) –

+0

이러한 논리를보기 m8에 넣지 마십시오. – lin