SeaMonster-Studios / angular-uc

UltraCart checkout built with AngularJS
2 stars 2 forks source link

Creating Cart and adding item #2

Closed harberg closed 10 years ago

harberg commented 10 years ago
  1. When the cart object is being created it is creating two instances.
  2. Unable to get POST request to go through to add an item to the cart object.
harberg commented 10 years ago
  1. This was my fault, I was passing the the controller twice, once with app.js and again with the html view.
  2. Can currently get item added to cart. Had to JSON.stringify data before adding it to the $http call.

Still need to separate out the createCart, loadItem, and addItem functions. Right now they are set up to be triggered with button clicks. Need to have the cart created and the item loaded on page load before the the addItem is called.

harberg commented 10 years ago

createCart is now a factory that can be called by other controllers. It will also be called on page load if the page in question has items on it.

loadItem has and if/else to check for the existence of a cart object and will load the item with or without the cart object. This enables both calls (loadItem and createCart) to be called at the same time.