在表格中使用 orderBy 过滤器
2017-02-06 16:33
260 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<style>
table,th,td{
border:1px solid grey;
border-collapse:collapse;
padding:5px;
}
table tr:nth-child(odd){
background-color: #f1f1f1;
}
table tr:nth-child(even){
background-color: #fff;
}
</style>
</head>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr ng-repeat="x in names | orderBy : 'Country' ">
<td>`x`.`Name`</td>
<td>`x`.`Country`</td>
</tr>
</table>
</div>
</body>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module("myApp",[]);
app.controller("customersCtrl",function($scope,$http){
$http.get("sites.php").success(function(response){
$scope.names = response.sites;
});
});
</script>
</html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<style>
table,th,td{
border:1px solid grey;
border-collapse:collapse;
padding:5px;
}
table tr:nth-child(odd){
background-color: #f1f1f1;
}
table tr:nth-child(even){
background-color: #fff;
}
</style>
</head>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr ng-repeat="x in names | orderBy : 'Country' ">
<td>`x`.`Name`</td>
<td>`x`.`Country`</td>
</tr>
</table>
</div>
</body>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module("myApp",[]);
app.controller("customersCtrl",function($scope,$http){
$http.get("sites.php").success(function(response){
$scope.names = response.sites;
});
});
</script>
</html>
相关文章推荐
- IE:使用搜索助手
- CMOS使用及维护须知
- CSS使用心得体会
- 表格标签table深入了解
- C#中尾递归的使用、优化及编译器优化
- 深入HTTP head的使用详解
- C#虚方法的声明和使用实例教程
- 影响jQuery使用的14个方面
- table 隔列(行)换色效果让表格结构更清淅
- 如何高效的使用内存
- table高级应用把表格进行到底(必看)
- Docker安装和简单使用入门教程
- VB返回记录集结果到HTML表格的方法
- jQuery对table表格进行增删改查
- Mysql使用简单教程(三)
- C#中Dictionary类使用实例
- PowerShell入门教程之创建和使用配置文件实例
- 表格高级使用技巧_把表格进行到底(必看)
- SQL语句实现查询SQL Server内存使用状况
- 使用准则进行条件查询