This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Resource cache just passes cache to $http, but doesn't cache instances #8739
Open
Description
Seems like cached actions might be cached on $http
level, but the resource instances are re-created every time. This obviously uses more memory, and also an unexpected behavior.
If I have a simple Category
resource with cached query
action, and I call Category.query()
from multiple directives, it does loads them all at once (expected) but instances in every place are different. Editing one instance on a directive (as an ngModel or whatever) doesn't affect the others. As a temporary solution I can wrap the query function and handle the caching myself but would be great if angular-resource
took care of it.
(Using latest 1.3 beta)
https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js#L567