After further investigation is seems that Restangular does not implement a feature to limit requests for same resource. The number of requests that go out to the server is dependent on the browser: Chrome only sends out only one GET request, IE 10 sends out two.
Multiple requests to same resource using Restangular
-
27-06-2022 - |
Question
Using the following two calls for identical resource:
var p1 = Restangular.one('accounts', 123).one('buildings', 456).get();
var p2 = Restangular.one('accounts', 123).one('buildings', 456).get();
Will Restangular send a single GET to the server or two? Is Restangular smart enough to know that there is already a request out to this resource when the second get() is issued?
Edit: Chrome shows only one request go out, but I'm still not sure if this is implemented in Restangular or in the browser?
Solution 2
OTHER TIPS
If you add a Cache, it'll also work on IE10 as that URL and its response would be cached.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow