I have a test to create a carting system
the cart needs to be implemented as an AngularJS service
the cart should be retrieved from the localStorage, where it’s stored under the key cart
every time an action is performed on the cart, it should be persisted on the localStorage
the cart should only know about item IDs and their quantity
angular.module('services.cart', [])
.service('Cart', ['$rootScope', 'Reviewer', function ($rootScope, Reviewer) {
var getCart = function(){};
var addItem = function(){};
var addItems = function() {};
var save = function() {};
var remove = function () {};
var clear = function() {};
var persist = function() {};
var changeQuantity = function (){};
var refresh = function() {};
}]);
I need helping writing the code that carry out the actions in the function.
Thanks