我在https://jsfiddle.net/8t45enfg/2/上有代码源代码非常简单,假设数组list仅具有一个元素HTML代码:
<div ng-controller="myController">
<table>
<tr>
<th>Name</th>
<th>Age</th>
<th>Job</th>
</tr>
<tr ng-repeat="a in list" ng-click='doClick()'>
<td ng-if='doCheck()'>{{ a.name }}</td>
<td>{{ a.age }}</td>
<td>{{ a.job }}</td>
</tr>
</table>
</div>
Js代码
module.controller("myController", function($scope) {
$scope.list = [ { name: 'test', age: 100, job: 'IT'} ]
$scope.doClick = function() {
console.log('doClick');
}
$scope.doCheck = function() {
console.log('doCheck');
return true;
}
});
Angular的摘要周期