質問

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?

役に立ちましたか?

解決 2

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.

他のヒント

If you add a Cache, it'll also work on IE10 as that URL and its response would be cached.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top