html 页面
<!DOCTYPE html>
<html ng-app>
<head>
<title>Angular.js</title>
<script type="text/javascript" src="angular-1.3.0.js"> </script>
<script type="text/javascript" src="test.js"></script>
</head>
<body ng-controller="CartController">
<div ng-repeat="item in items">
<h3>your order</h3>
<span>{{item.title}}</span>
<input type="text" ng-model="item.quantity">
<span>{{item.price | currency}}</span>
<span>{{item.price * item.quantity | currency}}</span>
<button ng-click="remove($index)">remove</button>
</div>
</body>
</html>
js页面
function CartController($scope){
$scope.items = [
{title:"paint posts", quantity:"8", price:"7.8"},
{title:"paint posts", quantity:"8", price:"7.8"},
{title:"paint posts", quantity:"8", price:"7.8"}
];
$scope.remove = function(index){
$scope.items.splice(index,1);
}
}