angular-表格
2016-03-22 22:54
525 查看
ng-repeat 指令可以完美的显示表格。
[/code]
[/code]
这个$odd$even是什么意思?
来自为知笔记(Wiz)
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr ng-repeat="x in names">
<td>{{ x.Name }}</td>
<td>{{ x.Country }}</td>
</tr>
</table>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("http://www.runoob.com/try/angularjs/data/Customers_JSON.php")
.success(function (response) {$scope.names = response.records;});
});
</script>
[/code]
<table>
<tr ng-repeat="x in names">
<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.Name }}</td>
<td ng-if="$even">{{ x.Name }}</td>
<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.Country }}</td>
<td ng-if="$even">{{ x.Country }}</td>
</tr>
</table>
[/code]
这个$odd$even是什么意思?
来自为知笔记(Wiz)
相关文章推荐
- angular-过滤器
- angular-基础
- angularJs
- AngularJS HTML DOM
- [Angular 2] Refactoring mutations to enforce immutable data in Angular 2
- angularjs 实现 window.onload() $(document).ready() 的方法
- AngularJS单页面应用的5大缺陷
- 用AngularJS监察表单按钮的禁用效果
- 高效利用Angular中内置服务
- 细说AngularJS directive
- [Angularjs]锚点操作服务$anchorScroll
- AngularJS中的表单应用一二
- 走进AngularJs 过滤器(filter)
- Angular2.0之后的思考,框架将被库取代
- AngularJS表单验证
- angular.js自定义指令
- angularJS
- [angularjs] angularjs系列笔记(四)控制器
- yeoman-angular-gulp
- AngularJS 服务(Service)