全与jia

<!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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值