Caching

AngularJS provides a simple caching system for your HTTP GET requests out of the box. To improve the performance of our application, we can turn on the framework's caching mechanism. It will store each response from the server, returning the same result every time the same request is made.

It comes disabled for all requests by default, but to enable caching for your requests, all you need to do is:
$http.get('http://server/myapi', {
cache: true
}).success(function() { // Handle success });

In the following code, we are enabling the cache mechanism.

run.js
parking.run(function ($http) {
$http.defaults.cache = true;
});
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +