2015-12-16 105 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