angular.js - angular怎麼寫出全選反選增刪單行單列的表格?
迷茫
迷茫 2017-05-15 16:50:17
0
1
536

angular怎麼寫出有全選反選增刪單行單列的表格?並且能夠有一個數組是選取的項目的數據,不用jq

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

全部回覆(1)
过去多啦不再A梦




文件標題>
腳本>


頭>



全選/反選


{{角色.text}}



雷雷

身體>

var app = angular.module("app", ["checklist-model"]);

app.controller('Ctrl', function($scope) {
$scope.roles = [
{id: 1, text: '客人'},
{id: 2, text: '使用者'},
{id: 3, text: '客戶'},
{id: 4, text: 'admin'}
];
$scope.ids = [];
//選擇結果集合
$scope.user = {
角色:[]
};

$scope.checkAll = function() {
console.log($scope.user.roles.length == $scope.roles.length)
if($scope.user.roles.length == $scope.roles.length){
$scope.user.roles = [];
$scope.ids = [];
}其他{
$scope.user.roles = angular.copy($scope.roles);
$scope.ids = [];
}

};
$scope.del =函數(){
for(x in $scope.user.roles){
$scope.ids.push($scope.user.roles[x].id);
}

console.log($scope.ids)
};

});

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!