Last active
August 29, 2015 14:15
-
-
Save jeshan/178a9194446b4a6dfe3f to your computer and use it in GitHub Desktop.
angular-intro-04; ngRepeat with an example of ngClass
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='angularApp'> | |
<head> | |
<meta name="description" content="angular-intro-04; ngRepeat"> | |
<script src="//code.jquery.com/jquery.min.js"></script> | |
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> | |
<script src="script.js"> | |
</script> | |
<meta charset="utf-8"> | |
</head> | |
<body ng-controller='MainController'> | |
<table class='table table-striped'> | |
<tr> | |
<th>id</th> | |
<th>Programming Language</th> | |
<th>Compiled</th> | |
</tr> | |
<tbody> | |
<tr ng-repeat='item in items' ng-class='{success: item.compiled}'> | |
<td ng-bind='item.id'></td> | |
<td ng-bind='item.description'></td> | |
<td><input ng-model='item.compiled' type='checkbox'/></td> | |
</tr> | |
</tbody> | |
</table> | |
</body> | |
</html> |
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
var module = angular.module('angularApp', [ ]); | |
module.controller('MainController', function($scope) { | |
$scope.items = [ | |
{id: 1, description: 'Java', compiled: true}, | |
{id: 2, description: 'C++', compiled: true}, | |
{id: 3, description: 'JavaScript', compiled: false}, | |
{id: 4, description: 'Python', compiled: false} | |
]; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment