AngularJS 中设置 AJAX get 请求不缓存的方法
2024-08-25 17:00:16
var app = angular.module('manager', ['ngRoute']); app.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when("/index", {
templateUrl: "/Templates/index.html",
controller: IndexCtrl
})
.when("/search", {
templateUrl: "/Templates/search.html",
controller: SearchCtrl
})
.when("/baseSettings", {
templateUrl: "/Templates/baseSettings.html",
controller: BaseSettings
})
.when("/aboutTech", {
templateUrl: "/Templates/aboutTech.html",
controller: AboutTech
})
.otherwise({ redirectTo: "/index" });
}]); app.config(["$httpProvider", function($httpProvider) {
if( !$httpProvider.defaults.headers.get ) {
$httpProvider.defaults.headers.get = {};
} // 禁用 IE AJAX 请求缓存
$httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
$httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
$httpProvider.defaults.headers.get['Pragma'] = 'no-cache';
}]);
参考:
http://stackoverflow.com/questions/16098430/angular-ie-caching-issue-for-http
最新文章
- webix前端架构的项目应用
- ASP.NET 显示项目之外的图片
- Python安装
- 用openvswitch配置跨节点的docker网络环境
- nginx禁止ip直接访问
- mysql一次添加多条记录
- Servlet Examples
- 如何解决ORA-12547: TNS:lost contact错
- 第三章 Netty入门应用
- 理解Device Tree Usage(续)
- 【转】Android 之最新最全的Intent传递数据方法
- html5 contenteditable 实现table可编辑(网页版EXCEL)
- 整理 logging 2种方式
- URL编码规则
- Hbase总结(六)hbase37个笔试题
- .NET 中的 async/await 异步编程
- bean-json-bean-json 工具
- invalidate和requestLayout方法源码分析
- Python并行编程(二):基于线程的并行
- Java小型知识点