<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="css/bootstrap.css" />
<script type="text/javascript" src="js/angularjs.js"></script>
<script type="text/javascript" src="js/project.js"></script>
</head>
<script></script>
<body ng-app>
<div class="container" ng-controller="controller1">
<div class="page-header">
<h1>我的购物车</h1>
</div>
<div class="row">
<div class="col-md-offset-10" style="margin-bottom:10px;">
<button class="btn btn-danger glyphicon glyphicon-trash" ng-show="cart.length" ng-click="cart={}"> 刪除购物车</button>
</div>
</div>
<table class="table table-bordered table-hover table" ng-show="cart.length">
<thead>
<tr>
<th><input type="checkbox" /></th>
<th>id</th>
<th>name</th>
<th>price</th>
<th>number</th>
<th>pricesum</th>
<th>option</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="goods in cart">
<td><input type="checkbox" /></td>
<td>{{goods.id}}</td>
<td>{{goods.name}}</td>
<td>{{goods.price | number:2 | currency:'$'}}</td>
<td>
<button class="btn btn-primary" style="width:1em;height:2em;" ng-click="reduce(goods.id)">-</button>
<input type="text" ng-model="goods.number" value="{{goods.number}}" style="width:3em;" />
<button class="btn btn-primary" style="width:1em;height:2em;" ng-click="add(goods.id)">+</button>
</td>
<td>{{goods.price*goods.number | number:2 | currency:'$'}}</td>
<td><button type="button" ng-click="remove($index)" class="glyphicon glyphicon-trash btn btn-danger"> 删除</button></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">总价为:{{sumPrice()| number:2 | currency:'$'}}</td>
</tr>
</tfoot>
</table>
<span ng-show="!cart.length">请去我的商城<a href="#">购物</a>吧!</span>
</div>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="css/bootstrap.css" />
<script type="text/javascript" src="js/angularjs.js"></script>
<script type="text/javascript" src="js/project.js"></script>
</head>
<script></script>
<body ng-app>
<div class="container" ng-controller="controller1">
<div class="page-header">
<h1>我的购物车</h1>
</div>
<div class="row">
<div class="col-md-offset-10" style="margin-bottom:10px;">
<button class="btn btn-danger glyphicon glyphicon-trash" ng-show="cart.length" ng-click="cart={}"> 刪除购物车</button>
</div>
</div>
<table class="table table-bordered table-hover table" ng-show="cart.length">
<thead>
<tr>
<th><input type="checkbox" /></th>
<th>id</th>
<th>name</th>
<th>price</th>
<th>number</th>
<th>pricesum</th>
<th>option</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="goods in cart">
<td><input type="checkbox" /></td>
<td>{{goods.id}}</td>
<td>{{goods.name}}</td>
<td>{{goods.price | number:2 | currency:'$'}}</td>
<td>
<button class="btn btn-primary" style="width:1em;height:2em;" ng-click="reduce(goods.id)">-</button>
<input type="text" ng-model="goods.number" value="{{goods.number}}" style="width:3em;" />
<button class="btn btn-primary" style="width:1em;height:2em;" ng-click="add(goods.id)">+</button>
</td>
<td>{{goods.price*goods.number | number:2 | currency:'$'}}</td>
<td><button type="button" ng-click="remove($index)" class="glyphicon glyphicon-trash btn btn-danger"> 删除</button></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">总价为:{{sumPrice()| number:2 | currency:'$'}}</td>
</tr>
</tfoot>
</table>
<span ng-show="!cart.length">请去我的商城<a href="#">购物</a>吧!</span>
</div>
</body>
</html>