In this Tutorial you will learn to build a shopping cart with angularjs . you can also integrate this Tutorial to your ecommerce app which we have created earlier here is the preview of our shopping cart

How it works…

First off, we need to install the shopping cart directive. As in the previous Tutorial, we will install it with Bower. Open your terminal window at the project root and type the following command:

bower install ngcart --save
  • Now, open the app folder and edit the app.js file. Add the following highlighted code after the ngAside dependency:
    angular.module('interfacecomponents', [
  • Let’s create a ngCart controller. Go to modules/shared/directives/ and create a folder called ngcart. Inside this folder, create a file called ngcartCtrl.js and add the following code:
    'use strict';
     * @ngdoc function
     * @name app.controller:ShopCartCtrl
     * @description
     * # ShopCartCtrl
     * Controller of the app
    .controller('ShopCartCtrl', ['$scope', 'ngCart', '$http', function ($scope, ngCart, $http) {