84669 personnes étudient
152542 personnes étudient
20005 personnes étudient
5487 personnes étudient
7821 personnes étudient
359900 personnes étudient
3350 personnes étudient
180660 personnes étudient
48569 personnes étudient
18603 personnes étudient
40936 personnes étudient
1549 personnes étudient
1183 personnes étudient
32909 personnes étudient
angular怎么写出带全选反选增删单行单列的表格?并且能够有一个数组是选中的项的数据,不用jq
业精于勤,荒于嬉;行成于思,毁于随。
<!DOCTYPE html> <html lang="fr" >
<tête> <titre>Document</titre> <script src="angular.js"></script> <script src="checklist.js"></script> <script src="app.js"></script> </tête>
<corps> <input type="checkbox" ng-checked="user.roles.length == rôles.length" ng-click="checkAll()" >全选/反选 <input type="checkbox" checklist-model="user.roles" checklist-value="role" > {{role.text}}
<br> <br> user.roles {{ user.roles}}<br> <br> role.id {{ids}}<br> <button class="right radius reveal-button" ng-click="del()">删除</button> </p>
</corps>
</html>
var app = angulaire.module("app", ["checklist-model"]);
app.controller('Ctrl', function($scope) { $scope.roles = [ {id : 1, texte : 'invité'}, {id : 2, texte : 'utilisateur'}, {id : 3, texte : 'client'}, {identifiant : 4, texte : 'admin'} ]; $scope.ids = []; //选择的结果集合 $scope.user = { rôles : [] };
$scope.checkAll = function() { console.log($scope.user.roles.length == $scope.roles.length) si($scope.user.roles.length == $scope.roles.length){ $scope.user.roles = []; $scope.ids = []; }autre{ $scope.user.roles = angulaire.copy($scope.roles); $scope.ids = []; >
}; $scope.del =fonction(){ pour(x dans $scope.user.roles){ $scope.ids.push($scope.user.roles[x].id); >
console.log($scope.ids) };
});
<!DOCTYPE html>
<html lang="fr" >
<tête>
<titre>Document</titre>
<script src="angular.js"></script>
<script src="checklist.js"></script>
<script src="app.js"></script>
</tête>
<corps>
<input type="checkbox" ng-checked="user.roles.length == rôles.length" ng-click="checkAll()" >全选/反选
<input type="checkbox" checklist-model="user.roles" checklist-value="role" > {{role.text}}
</corps>
</html>
var app = angulaire.module("app", ["checklist-model"]);
app.controller('Ctrl', function($scope) {
$scope.roles = [
{id : 1, texte : 'invité'},
{id : 2, texte : 'utilisateur'},
{id : 3, texte : 'client'},
{identifiant : 4, texte : 'admin'}
];
$scope.ids = [];
//选择的结果集合
$scope.user = {
rôles : []
};
$scope.checkAll = function() {
console.log($scope.user.roles.length == $scope.roles.length)
si($scope.user.roles.length == $scope.roles.length){
$scope.user.roles = [];
$scope.ids = [];
}autre{
$scope.user.roles = angulaire.copy($scope.roles);
$scope.ids = [];
>
};
$scope.del =fonction(){
pour(x dans $scope.user.roles){
$scope.ids.push($scope.user.roles[x].id);
>
console.log($scope.ids)
};
});