网络请求 点击排序

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="js/angular.js"></script>
<script>
var app=angular.module("myapp",[]);
app.controller("myctrl",function($scope,$http){
$http.get("http://result.eolinker.com/lKgJQ8Zec38423e5603b8e055d1193a8127c0c060bb1b55?uri=goodstest")
.success(function(qing){
$scope.username = qing;
})
//全选
$scope.qx=function(){
for(var i in $scope.username){
$scope.username[i].ck=$scope.all;
}
}
//点击排序
$scope.paixuorder = "id";
$scope.pai = true;
$scope.paixu = function(dianji){
console.log(dianji);
if(dianji == $scope.paixus){
$scope.pai = !$scope.pai;
}else{
$scope.pai = false;
}
$scope.paixuorder = dianji;
}
});
</script>
</head>
<body ng-app="myapp" ng-controller="myctrl">
<table border="1px" cellpadding="10" cellspacing="1">
<tr>
<th><input type="checkbox" ng-model="all" ng-click="qx()"/></th>
<th>ID<button ng-model="pai" ng-click="paixu('id')">排序</button></th>
<th>商品名</th>
<th>用户名</th>
<th>手机号</th>
<th>价格<button ng-model="pai" ng-click="paixu('price')">排序</button></th>
<th>城市</th>
<th>下单时间<button ng-model="pai" ng-click="paixu('state')">排序</button></th>
<th>状态</th>
</tr>
<tr ng-repeat="s in username | orderBy:paixuorder:pai">
<td><input type="checkbox" ng-model="s.ck"/></td>
<td>{{s.id}}</td>
<td>{{s.gname}}</td>
<td>{{s.uname}}</td>
<td>{{s.tel}}</td>
<td>{{s.price}}</td>
<td>{{s.city}}</td>
<td>{{s.regdate}}</td>
<td>{{s.state}}</td>
</tr>
</table>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值