Created
August 21, 2014 11:16
-
-
Save kfly8/e65bb6e9b5f1425e2d9d to your computer and use it in GitHub Desktop.
angular sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html ng-app='sample'> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"></script> | |
<script> | |
angular.module('sample', []) | |
.controller('MainCtrl', ['$scope', function($scope) { | |
$scope.bulk_check = function() { | |
angular.forEach($scope.items, function(item) { | |
item.ng_checked = $scope.bulk_check_fg; | |
}); | |
}; | |
}]); | |
</script> | |
</head> | |
<body> | |
<div ng-controller="MainCtrl" ng-model="items" ng-init="items = [{ 'name':'ほげ' }, { name:'ふが' }]"> | |
<input type="checkbox" ng-model="bulk_check_fg" ng-change="bulk_check()">一括 | |
<ul> | |
<li ng-repeat="item in items"> | |
<input type="checkbox" ng-checked=item.ng_checked ng-model=item.ng_checked>{{item.name}}:{{item.ng_checked}} | |
</li> | |
</ul> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment