Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. $scope.addToCart = function(key, size, price) {
  2.  
  3.  
  4. //Add selected size and price
  5.  
  6. //Add 'extra' for selected price and size
  7. $scope.selectedProduct.extra = {};
  8. $scope.selectedProduct.extra = {
  9. //price is a float
  10. price: price,
  11. //$scope.productSizes is a single array that
  12. //changes int values to sizes (1 => individual, 2 => medium ...)
  13. size: $scope.productSizes[size],
  14. //size is the int value of the size
  15. sizeInt: size
  16. };
  17.  
  18. $scope.cart.push($scope.selectedProduct);
  19. };
  20.  
  21. 0 Object
  22. extra: Object
  23. price: "1.99"
  24. size: "Individual"
  25. sizeInt: 1
  26.  
  27. 0: Object
  28. extra: Object
  29. price: "6.5"
  30. size: "Large"
  31. sizeInt: 3
  32. 1: Object
  33. extra: Object
  34. price: "6.5"
  35. size: "Large"
  36. sizeInt: 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement