Checklist-model 在 Angular 用法中
Checklist-model in Angular usage
我的标题是部门,副标题是员工。我想要做的是当用户检查标题或部门时,应检查所有员工或字幕。我在 html 和 ng-repeat 中使用字段集和 table。看起来像这个问题,但主要区别在于从 db 获取数据
我找不到我想念的东西。任何想法任何帮助。谢谢 。
HTML
<fieldset id="field3">
<table>
<tr ng-repeat="emp in empdepts | groupBy:'dep_LDesc'">
<td>
<label ng-click="showContent = !showContent"></label>
<details ng-open="showContent">
<summary> <input type="checkbox" class="test" ng-model="check_all_domains" ng-click="toggle_select_all()" /> {{emp[0].dep_LDesc}}</summary>
<div ng-repeat="semployee in emp" class="test">
<input type="checkbox" checklist-model="objects_selected" checklist-value="semployee">
{{semployee.Sname}}<div style="display:none;">{{semployee.staffkey}}{{semployee.depkey}}</div>
</div>
</details>
</td>
</tr>
</table>
</fieldset>
控制器
/// <reference path="Scripts/angular.js" />
///
///
Assign.controller("AssignController", function ($scope, Assignments) {
Loaddepts();
function Loaddepts()
{
Assignments.getdepts().then (function(response){
$scope.depts = (response.data);
console.log($scope.depts);
})
}
//$scope.employees = [];
//$scope.checked = { employees: ['semployee'] }
//$scope.checkAll = function () {
// $scope.checked.employees = angular.copy($scope.employees);
//};
//$scope.uncheckAll = function () {
// $scope.checked.employees = [];
//};
//$scope.emp = $scope.empdepts;
$scope.objects_selected = [];
$scope.check_all_domains = false;
$scope.toggle_select_all = function () {
$scope.objects_selected = true;
//$scope.check_all_domains = true;
//$scope.objects_selected = angular.copy($scope.emp);
//angular.copy($scope.emp, $scope.objects_selected);
};
LoadEmpDepts();
function LoadEmpDepts()
{
Assignments.getempdepts().then (function (response){
$scope.empdepts = (response.data);
console.log($scope.empdepts);
})
}
$scope.selectedRow1 = null; // initialize our variable to null
$scope.setClickedRow1 = function (employee) { //function that sets the value of selectedRow to current index
$scope.selectedRow1 = employee;
}
$scope.save = function()
{
}
});
}
提前致谢
<table>
<tr ng-repeat="e in empdepts | groupBy:'dep_LDesc'">
<td>
<label ng-click="showContent = !showContent"></label>
<details ng-open="showContent">
<summary><input type="checkbox" ng-model="chk" /> {{e[0].dep_LDesc}}</summary>
<div ng-repeat="employee in e">
<input type="checkbox" ng-checked="chk"> {{employee.Sname}}
</div>
</details>
</td>
</tr>
</table>
我的标题是部门,副标题是员工。我想要做的是当用户检查标题或部门时,应检查所有员工或字幕。我在 html 和 ng-repeat 中使用字段集和 table。看起来像这个问题,但主要区别在于从 db
HTML
<fieldset id="field3">
<table>
<tr ng-repeat="emp in empdepts | groupBy:'dep_LDesc'">
<td>
<label ng-click="showContent = !showContent"></label>
<details ng-open="showContent">
<summary> <input type="checkbox" class="test" ng-model="check_all_domains" ng-click="toggle_select_all()" /> {{emp[0].dep_LDesc}}</summary>
<div ng-repeat="semployee in emp" class="test">
<input type="checkbox" checklist-model="objects_selected" checklist-value="semployee">
{{semployee.Sname}}<div style="display:none;">{{semployee.staffkey}}{{semployee.depkey}}</div>
</div>
</details>
</td>
</tr>
</table>
</fieldset>
控制器
/// <reference path="Scripts/angular.js" />
/// ///
Assign.controller("AssignController", function ($scope, Assignments) {
Loaddepts();
function Loaddepts()
{
Assignments.getdepts().then (function(response){
$scope.depts = (response.data);
console.log($scope.depts);
})
}
//$scope.employees = [];
//$scope.checked = { employees: ['semployee'] }
//$scope.checkAll = function () {
// $scope.checked.employees = angular.copy($scope.employees);
//};
//$scope.uncheckAll = function () {
// $scope.checked.employees = [];
//};
//$scope.emp = $scope.empdepts;
$scope.objects_selected = [];
$scope.check_all_domains = false;
$scope.toggle_select_all = function () {
$scope.objects_selected = true;
//$scope.check_all_domains = true;
//$scope.objects_selected = angular.copy($scope.emp);
//angular.copy($scope.emp, $scope.objects_selected);
};
LoadEmpDepts();
function LoadEmpDepts()
{
Assignments.getempdepts().then (function (response){
$scope.empdepts = (response.data);
console.log($scope.empdepts);
})
}
$scope.selectedRow1 = null; // initialize our variable to null
$scope.setClickedRow1 = function (employee) { //function that sets the value of selectedRow to current index
$scope.selectedRow1 = employee;
}
$scope.save = function()
{
}
});
}
提前致谢
<table>
<tr ng-repeat="e in empdepts | groupBy:'dep_LDesc'">
<td>
<label ng-click="showContent = !showContent"></label>
<details ng-open="showContent">
<summary><input type="checkbox" ng-model="chk" /> {{e[0].dep_LDesc}}</summary>
<div ng-repeat="employee in e">
<input type="checkbox" ng-checked="chk"> {{employee.Sname}}
</div>
</details>
</td>
</tr>
</table>