Process Advisors

*Subject to Terms and Condition

AngularJS Use Case – Shopping Cart Application

Here we are creating a shopping Cart Application and code for this application is as follows:

<html ng-app='scartApp'>
<script src=""></script>
<title>Shopping Cart</title>
<body ng-controller='SCartController'>
<h1>Shopping Cart Application</h1>
<table border = "1">
<td><b>Product Name</b></td>
<td><b>Total Price</b></td>
<tr ng-repeat="item in items">
<td><input ng-model='item.quantity'></td>
<td>{{item.price | currency}}</td>
<td> {{item.price * item.quantity | currency}}</td>
<td><button ng-click="remove($number)">Remove</button></td>
var sapp = angular.module('scartApp', []);
sapp.controller('SCartController', ['$scope', function($scope) {
$scope.items = [
{Name: 'Saree', quantity: 10, price: 100},
{Name: 'Mojari', quantity: 12, price: 40},
{Name: 'Bangles', quantity:8, price: 15},
{Name: 'Jeans', quantity:5, price: 20}
$scope.remove = function(number) {
$scope.items.splice(number, 1);
</html><button ng-click="remove($index)">Remove</button>
<script src="angular.js"></script>
function CartController($scope) {
$scope.items = [
{title: 'Paint pots', quantity: 8, price: 3.95},
{title: 'Polka dots', quantity: 17, price: 12.95},
{title: 'Pebbles', quantity: 5, price: 6.95}
$scope.remove = function(index) {
$scope.items.splice(index, 1);


Watch this Full Stack Web Development Course video


  • <html ng-app> – It tells Angular which parts of the page it should handle.
  • <body ng-controller=’CartController’> – SCartController will handle everything between <body> and </body>.
  • <tr ng-repeat=”item in items”> – It creates an array of item.
  • <td>{{item.Name}}</td> – Display Product Name
  • <td><input ng-model=’item.quantity’></td> – The ng-model makes data binding between the input field and the value of quantity.
  • <td>{{item.price | currency}}</td> – Display the price of item in $ using currency tag.
  • <td> {{item.price * item.quantity | currency}}</td> – It displays the total price of the item which is the multiplication of price and quantity.
  • <button ng-click=‘remove ($index)’>Remove</button> – Creates a button remove. It will remove the item if you click on this button.
  • function SCartController($scope) { } – Manages the logic of this application.
  • $scope.items = [ ]; – It defines the collection of item for your shopping cart application.

If you are an AngularJS enthusiast, enroll in the Angular Training and get certified now!

Course Schedule

Name Date Details
Web Development Courses 03 Jun 2023(Sat-Sun) Weekend Batch
View Details
Web Development Courses 10 Jun 2023(Sat-Sun) Weekend Batch
View Details
Web Development Courses 17 Jun 2023(Sat-Sun) Weekend Batch
View Details

Leave a Reply

Your email address will not be published. Required fields are marked *

Find Best AngularJS Training in Other Regions

Bangalore Hyderabad Chennai Mumbai