goodeggs / angular-cached-resource

An AngularJS module to interact with RESTful resources, even when browser is offline
MIT License
216 stars 29 forks source link

deep copy of a cached resource #45

Open leseulsteve opened 10 years ago

leseulsteve commented 10 years ago

Great module btw! Good work guys!

I use angular.copy() to put a resource in a temp variable to revert change made on it later on. It doesn't work, with this code:

itemTemp = angular.copy(item); console.log(item, itemTemp) item = itemTemp; item.$update(); // PUT METHOD

I get this in the console:

CachedResource {id: 1}, Object {id: 1} XMLHttpRequest cannot load ...

hazeledmands commented 10 years ago

Awesome! Thanks for the report; sorry for taking such a long time to take a look into it. Filed as a bug; I'll try and fix it soon as I can. In the meantime, if you have the bandwidth to write a failing test for it that'd be excellent!