<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/angular.min.js"></script>
<script>
angular.module("cg",[]).controller("tr",function($scope,$http){
$http.get("http://result.eolinker.com/rR1VBtT56a6bb220c10b3d44b65b4787a8aec03c4ec32ce?uri=ThirdTest")
.success(function(ol){
$scope.datas=ol;
//加减方法
$scope.jia=function(i){
i.number=i.number+1;
}
$scope.jian=function(i){
i.number=i.number-1;
}
})
//全选方法
$scope.qu=function(){
var t=$scope.id;
for(var i in $scope.datas){
$scope.datas[i].cli=t;
}
}
})
</script>
</head>
<body ng-app="cg" ng-controller="tr">
<h1 align="center">我的购物车详情</h1>
<table border="1">
<!--全选定义-->
<td><input type="checkbox" ng-model="id" ng-click="qu()"></td>
<td>商品编号</td>
<td>商品名称</td>
<td>商品数量</td>
<td>商品单价</td>
<td>价格小计</td>
<td>操作</td>
</tr>
<tr ng-repeat="x in datas" style="background: #4CD964;"> <!--颜色定义-->
<!--全选-->
<td><input type="checkbox" ng-model="x.cli"></td>
<td>{{x.id}}</td>
<td>{{x.name}}</td>
<td >{{x.price}}</td>
<td>
<!--加减符号-->
<button ng-click="jian(x)">-</button>
<input type="number" ng-model="x.number" style="width:30px;">
<button ng-click="jia(x)">+</button></td>
<!--加减符号-->
</td>
<td>{{x.price*x.number|currency:"¥"}}</td>
</tr>
</table>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/angular.min.js"></script>
<script>
angular.module("cg",[]).controller("tr",function($scope,$http){
$http.get("http://result.eolinker.com/rR1VBtT56a6bb220c10b3d44b65b4787a8aec03c4ec32ce?uri=ThirdTest")
.success(function(ol){
$scope.datas=ol;
//加减方法
$scope.jia=function(i){
i.number=i.number+1;
}
$scope.jian=function(i){
i.number=i.number-1;
}
})
//全选方法
$scope.qu=function(){
var t=$scope.id;
for(var i in $scope.datas){
$scope.datas[i].cli=t;
}
}
})
</script>
</head>
<body ng-app="cg" ng-controller="tr">
<h1 align="center">我的购物车详情</h1>
<table border="1">
<!--全选定义-->
<td><input type="checkbox" ng-model="id" ng-click="qu()"></td>
<td>商品编号</td>
<td>商品名称</td>
<td>商品数量</td>
<td>商品单价</td>
<td>价格小计</td>
<td>操作</td>
</tr>
<tr ng-repeat="x in datas" style="background: #4CD964;"> <!--颜色定义-->
<!--全选-->
<td><input type="checkbox" ng-model="x.cli"></td>
<td>{{x.id}}</td>
<td>{{x.name}}</td>
<td >{{x.price}}</td>
<td>
<!--加减符号-->
<button ng-click="jian(x)">-</button>
<input type="number" ng-model="x.number" style="width:30px;">
<button ng-click="jia(x)">+</button></td>
<!--加减符号-->
</td>
<td>{{x.price*x.number|currency:"¥"}}</td>
</tr>
</table>
</body>
</html>