Skip to content

Instantly share code, notes, and snippets.

@limichange
Created March 1, 2014 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save limichange/9285408 to your computer and use it in GitHub Desktop.
Save limichange/9285408 to your computer and use it in GitHub Desktop.
change css3
<!doctype html>
<html lang="en" ng-app>
<head>
<meta charset="UTF-8">
<title>test</title>
<style>
.selected {
background-color: lightgreen;
}
</style>
</head>
<body>
<table ng-controller='tableController'>
<tr ng-repeat='item in list'
ng-click='selectItem($index)'
ng-class='{selected: $index == selectedRow}'>
<td>{{item.name}}</td>
<td>{{item.age}}</td>
</tr>
</table>
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
function tableController($scope) {
$scope.list = [
{name: 'houyao', age: 12},
{name: 'liurui', age: 22},
{name: 'daxue', age: 42}
];
$scope.selectItem = function(row) {
$scope.selectedRow = row;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment