angular-local-storage icon indicating copy to clipboard operation
angular-local-storage copied to clipboard

Service won't store objects

Open cabstool opened this issue 9 years ago • 6 comments
trafficstars

I get a JSON stringify error when attempting to store any object: error converting circular reference. I'm 100% sure my object(s) do not have circular references.

cabstool avatar Mar 24 '16 17:03 cabstool

Is there any way you can provide more detail for reference? Is anyone else experiencing this issue?

grevory avatar Mar 24 '16 18:03 grevory

I'm using Breeze and Angular to get an entity object from my backend. The object has no references to itself or any other object at all. When I call localStorageService.set("name", object) I get the JSON.stringify error saying that it cannot convert an object containing a circular reference...

cabstool avatar Mar 24 '16 18:03 cabstool

here is my client side object i'm attempting to store:

{ "$id": "1", "$type": "mydomain.Models.Location, mydomain", "Zip": "99999", "City": "city", "State": "state" },

it's a Breeze entity object which came over from my Breeze server.....

cabstool avatar Mar 24 '16 19:03 cabstool

Hi Gregory,

Any progress on this bug? Thanks.

On Thu, Mar 24, 2016 at 1:14 PM, Gregory Pike [email protected] wrote:

Is there any way you can provide more detail for reference? Is anyone else experiencing this issue?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/grevory/angular-local-storage/issues/301#issuecomment-200955517

cabstool avatar Mar 26 '16 11:03 cabstool

No, I am not working on bugs at the moment. Feel free to submit a PR.

grevory avatar Mar 26 '16 12:03 grevory

@cabstool The current work around for this is to stringify the object. Once you want to get the object, there is no need of parsing the content. It automatically, gives you object.

akanshgulati avatar Nov 11 '16 15:11 akanshgulati