如何解决AngularJs在IE下取数据总是缓存的问题
var config = ["$routeProvider", "$httpProvider", function ($routeProvider, $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';
// Disable IE ajax request caching
$httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
$httpProvider.defaults.headers.get['Pragma'] = 'no-cache';
$routeProvider.when("/", { templateUrl: "Manage/dashboard/index.cshtml" })
.when("/dashboard", { templateUrl: "Manage/dashboard/index.cshtml" })
.when("/dashboard/serverinfo", { templateUrl: "Manage/dashboard/serverinfo.cshtml" })
.when("/dashboard/emaillogs", { templateUrl: "Manage/dashboard/emaillogs.cshtml" })
// other code....
.otherwise({ redirectTo: "/" });
}];
app.config(config);Last updated