angularJS学习1
<!DOCTYPE html>
<html ng-app>
<head>
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
</head>
<body ng-controller='CartController'>
<table>
<tr ng-repeat='item in items'>
<td><span>{{item.title}}</span></td>
<td><input ng-model='item.quantity' /></td>
<td><span ng-bind="item.price"></span><span>元</span></td>
<td><span>{{item.price*item.quantity}}元</span></td>
<td><button ng-click='remove($index)'>Remove</button></td>
</tr>
</table>
<script>
function CartController($scope)
{
$scope.items=[
{
title:'book1',
quantity:1,
price:68.5
},
{
title:'book2',
quantity:1,
price:78.5
}
];
$scope.remove=function(index)
{
$scope.items.splice(index,1);
}
}
</script>
</body>
</html>