废话不多说了,直接给大家贴代码了,具体代码如下所示; 

<!DOCTYPE html>
<html lang="en" ng-app="testMo">
<head>
 <meta charset="UTF-8">
 <title></title>
 <link rel="stylesheet" href="css/bootstrap.css" rel="external nofollow" >
 <style>
 .div1{
  margin: 20px;
 }
 </style>
</head>
<body>
<div ng-controller="testCtrl" class="div1">
 <h4>angularJS--购物车实现全选/取消全选</h4>
 <button type="button" class="btn btn-info" ng-click="addProduct()">添加商品</button>
 <button type="button" class="btn btn-danger" ng-click="deleteProduct()">删除商品</button>
 <br><br>
 <table class="table table-bordered table-responsive" >
 <thead>
 <td>操作</td>
 <td>check状态</td>
 <td>商品名称</td>
 <td>单价</td>
 <td>数量</td>
 <td>小计</td>
 </thead>
 <tr ng-repeat="p in cart" >
  <td><input type="checkbox" ng-checked="p.checked" ng-click="echoChange(p.id,p.checked,selectAll)"></td>
  <td>{{p.checked}}||{{p.checked}}</td>
  <td>{{p.name}}</td>
  <td>单价:¥{{p.price}}</td>
  <td>数量:<input type="number" ng-model="p.count" min="0" value="p.count"></td>
  <td>小计:¥{{p.sum}}</td>
 </tr>
 </table>
 <br>
 <input type="checkbox" ng-model="selectAll" ng-click="selectAllClick(selectAll)"><span ng-hide="selectAll" >全选</span><span ng-show="selectAll">取消全选</span>
 <br><br>
 已选择<span>{{jishuqi}}</span>件商品,总金额:<span>¥{{ sumTotal }}</span>
</div>
<script src="/UploadFiles/2021-04-02/angular.js">PS:下面给大家分享angularjs 购物车的代码,具体代码如下所示:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>购物车</title>
  <script type="text/javascript" src="/UploadFiles/2021-04-02/angular.js">

好了,代码到此结束。

总结

以上所述是小编给大家介绍的AngularJS 实现购物车全选反选功能,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com