The example of this article is about the solution of angularjs in IE, which always caches the data. Share to everyone for your reference, specific as follows:
Problem:
When you use the ANGULARJS issue request (get) to obtain the server-side data and then bind to the page, you will find that the original data results are always displayed in IE. At this point we will know that IE has done caching.
Solution:
We can set it in the Angularjs configuration by $httpprovider to not cache it. The details are as follows:
Ngapp.config (function ($httpProvider) {
//Initialize get if not there
if (! $httpProvider. Defaults.headers.get {
$httpProvider. defaults.headers.get = {};
}
Enables Request.isajaxrequest () in asp.net MVC
$httpProvider. defaults.headers.common["X-requested-with"] = ' XMLHttpRequest ';
Disables the caching of IE for Ajax
$httpProvider. defaults.headers.get[' cache-control ' = ' no-cache ';
$httpProvider. defaults.headers.get[' Pragma '] = ' no-cache ';
});
I hope this article will help you to Angularjs program design.