Created
March 1, 2014 04:54
-
-
Save limichange/9285415 to your computer and use it in GitHub Desktop.
change css3
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 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> |
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
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