1

I want to disable cache on angular ui grid. How can I do it? It is not mentioned in the documentation or tutorials.

I already have tried this:

$(function () {
   console.log("ready!"); //Disable Local Cache 
    $.ajaxSetup({ cache: false }); 
});
Rahul Gupta
  • 23
  • 1
  • 8
  • I had to add multiple header values as specified in this thread. http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers – Rahul Gupta Jun 08 '15 at 20:03

1 Answers1

0

How are providing data to ui-grid? You have to disable caching in the place from where you getting the data. If you are using $http then you can pass the no-cache header along with the request.

E.g.

$http.get( 'url' , { headers: { 'Cache-Control' : 'no-cache' } } );

If you are using ajax then whatever you have commented in the question should work fine.

ShankarSangoli
  • 67,648
  • 11
  • 84
  • 121
  • Even after adding the above header in my $http.get call, it still loads the values from cache in my angular grid. Also, the code I have in my question does not helps in angular grid, but it helps on the other pages with my client AJAX requests. – Rahul Gupta Jun 08 '15 at 19:55