How to enable caching in $http service?



How to enable caching in $http service?..

Answer / chaitanya

You can enable caching in $http service by setting configuration property cache to true. When cache is enabled, $http service stores the response from the server in local cache. In this way, next time the response will be served from the cache without sending request to server. $http.get("http://server/myserviceapi",{ cache:true }).sucess(function(){ //TO DO: });

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What Is The Difference Between One-Way Binding And Two-Way Binding?

0 Answers  


What is @inject()?

0 Answers  


What is a scope in a project?

0 Answers  


What are Modules in AngularJS?

1 Answers  


What is the spa (single page application) in angularjs?

0 Answers  






What is the use of filter in angularjs?

0 Answers  


What is the difference between a stateful and stateless component in angularjs?

0 Answers  


What is the use of restrict and template property when creating custom directives?

0 Answers  


Explain how $scope.$Apply() works

0 Answers  


Difference between display:none & visiblity:hidden?

0 Answers  


How is shadow dom helping angular 2 to perform better?

0 Answers  


Is angular a good career?

0 Answers  


Categories