this.addToCart = function(id,name,category,price) {
alert(id+"name"+name);
var eachProduct = [
{
"name": name,
"id": id,
"category":category,
"price":price
}
];
//$scope.obj = item;
//alert($scope.obj.name);
alert("product Name :"+eachProduct[0].name);
var arrayList = [];
arraylist.push(eachProduct);
sessionStorage.setItem("addedProductsList", eachProduct);
return "success";
and I am retrieving the values arrayList from the sessionStorage
var retrieveArray= sessionStorage.addedProductsList;
alert(retrieveArray.eachProduct[0].name);//getting undefined
I am retrieving in another service how to push each product into arrayList and store it in the session storage.
alert(retrieveArray.eachProduct[0].name);
withalert(retrieveArray[0].name);