Shopping Cart with AngularJS Example
Create a Simple Shopping Cart using Angularjs
A Shopping Cart Application Built with AngularJS.Shopping Cart in angularjs and ecommerce example in angularjs in the Best way possible.
A Shopping Cart Application Built with AngularJS.Shopping Cart in angularjs and ecommerce example in angularjs in the Best way possible.
var calcApp = angular.module('calcApp', []);
calcApp.controller('CartForm', function ($scope) {
$scope.invoice = {
items: [{
qty: 10,
description: 'item',
cost: 9.00}]
};
$scope.addItem = function() {
$scope.invoice.items.push({
qty: 1,
description: '',
cost: 0
});
},
$scope.removeItem = function(index) {
$scope.invoice.items.splice(index, 1);
},
$scope.total = function() {
var total = 0;
angular.forEach($scope.invoice.items, function(item) {
total += item.qty * item.cost;
})
return total;
}
});