标签:
在使用AngularJS发出请求(GET)获取服务端数据,然后再绑定到页面中,你会发现在IE中总是显示原来的数据结果。这时候我们就会知道,IE做了缓存。
1 ngApp.config(function ($httpProvider) { 2 // Initialize get if not there 3 if (!$httpProvider.defaults.headers.get) { 4 $httpProvider.defaults.headers.get = {}; 5 } 6 7 // Enables Request.IsAjaxRequest() in ASP.NET MVC 8 $httpProvider.defaults.headers.common["X-Requested-With"] = ‘XMLHttpRequest‘; 9 10 //禁用IE对ajax的缓存 11 $httpProvider.defaults.headers.get[‘Cache-Control‘] = ‘no-cache‘; 12 $httpProvider.defaults.headers.get[‘Pragma‘] = ‘no-cache‘; 13 });
标签:
原文地址:http://www.cnblogs.com/qubernet/p/5552626.html