var app = angular.module('app', []); app.controller('appController', function ($scope) { $scope.items = [{ title: 'Paint pots', quantity: 7, price: 12.50 }, { title: 'Polka dots', quantity: 2, price: 10.00 }, { title: 'Pebbles', quantity: 5, price: 25.50 }]; $scope.remove = function (index) { $scope.items.splice(index, 1); } });
<section ng-app="app"> <div ng-controller="appController"> <h1>Shopping Cart</h1> <div ng-repeat="item in items"> <span>{{item.title}}</span> <input type="number" ng-model="item.quantity"> <span>{{ item.quantity }} * {{item.price | currency}}</span> = <span>{{item.price * item.quantity | currency}}</span> <button ng-click="remove($index)">Remove</button> </div> </div> </section>