2015-12-16 106 views
0

我正在使用AngularJs来构建应用程序。在IE中,即使在致电$route.reload()后,数据也不会刷新。但它在其他浏览器中工作正常。即使我测试了不同的系统,我仍面临同样的问题。

下面是代码提前

Service.methodname(data1) 
    .success(function (data, status, header, config) { 
     $scope.response = data; 
     $('#mySchedulElection').modal('hide');     
     if (data == 1) { 
      $scope.showmessage('Election successfully saved', $scope.MessageType.success); 
      $route.reload();    
     } 
    } 
}); 

感谢。

+0

试用,$ location.refresh() ; – ozgur

+0

对象不支持属性或方法'刷新' - 获取此错误。我注入了$ location服务 –

+0

@ArunKumarM你必须在控制器/模块/ factrory /指令中声明“$ location变量,然后用它作为$ location.refresh(); –

回答

0

在服务中检查您的缓存策略。默认情况下,AngularJs会缓存你的请求。 尝试使用

$http.get('url', {cache: false}); 

也许这是一个更好的主意来创建此请求的缓存对象,以便更好地控制缓存行为。

$http.get('url', {cache: serviceCache}); 

,然后当你需要它,你可以缓存失效:

serviceCache.removeAll(); 

更多信息,请参见

https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache