snapjay / ngCart

Really simple shopping cart for AngularJS
http://ngcart.snapjay.com
380 stars 236 forks source link

ngcart-addtocart Data Field Issue #82

Closed wizyoua closed 7 years ago

wizyoua commented 7 years ago

Hello, I am trying to send more more data other than price and name, by searching the docs it says I can use the data="" attribute. I have an array of objects that contains much more data. Is data="{{myItem.Ingredients}}" something I can do to send that array with the item when it is ready to check out. I dont need to display it in the checkout screen but just want all that information connected since it is important.

Would anybody help explain how I can go about this or send me in the right direction. Thank You

wizyoua commented 7 years ago

I even tried creating a normal simple object and populate the data with data="$scope.test"

$scope.test = {"name" : "example", "number" : 480, "address" : "blah" }

wizyoua commented 7 years ago

Ok so after a full day of testing, I was accidentally inputting angular in the data field when there isn't a need to. Don't do data="{{test.myObject}}" or data="$scope.object" all I did was put data="test.myObject" without the braces. Of course this needs to be in the controller and in my case the ng-repeat that is repeating all the objects as well.

Whenever my item is added to cart and click checkout: the console.log response shows my item and if you dig deeper you will that the data field actually has an object or array, whatever you put in there.

Also if you are getting an error that says the function.successful is not a function, someone else posted that issue. they added the answer so that issue wont happen.

Overall after the steps above are completed, once you click checkout you will get the object in your console.