@roma35 wrote:
hi I need your help please.
I have a problem with my controller and my factory my code is here:
this is my factory
` var zupa_io = angular.module('zupa.zfactory', []);zupa_io.factory('zupafactory',function($http){ // in here I retrieve my data in localStorage var products = angular.fromJson( window.localStorage['zupacart'] || '[]' ); // in here I store my data in localStorage function zupapersist(){ window.localStorage['zupacart'] = angular.toJson(products); } return { // this is my function for save ZupaSaveCart:function(prod){ products.push(prod); zupapersist(); console.log(products); }, }
});`
my problem is when a try save my data, show me this error (products.push is not a function) but de products is present.
please help me
Posts: 1
Participants: 1