Sha256: c799be4ac263b6ae55cc8e8f8dc099a2eca14eb541247692ab96d14affd91b3d

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

(function() {
  'use strict';

  angular
    .module('Redshop')
    .factory('cartService', cartService);

  function cartService(Restangular) {
    var service = {
      addToCart    : addToCart,
      getCartCount : getCartCount 
    }

    var baseUrl = 'http://localhost:3000/shop/api'

    return service;
    ///////////////////
    
    function addToCart(cartId, productId) {
      return Restangular.oneUrl('cart', baseUrl + '/cart/add/').customPUT({'cart_id': cartId, product_id: productId});
    };

    function getCartCount() {
      return Restangular.oneUrl('count', baseUrl + '/cart/count/').get();
    }
  }
})();

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redshop-0.0.1 app/assets/javascripts/redshop/angular/components/home.js