In my angular application I have the following controller (I have deleted some methods due privacy policy):
.controller('ArticleCtrl', ['$http', '$scope', '$location', '$localStorage', '$q', '$templateCache', 'authService', 'uploaderService', 'settings', function($http, $scope, $location, $localStorage, $q, $templateCache, authService, uploaderService, settings) { $scope.isAuth = authService.checkAuthStatus() || false; if ($scope.isAuth == false) { $location.path('/signin'); } $scope.username = $localStorage.authStatus.userName; $scope.getCompany = function(id) { $http.get(settings.apiBaseUri + '/app/' + id, { headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-cache' } }) .success(function(response) { $scope.company = response; $scope.company.Email = $scope.username; }) .error(function(data, status, headers, config) { console.log('operation failed, status: ' + data); $location.path('/signin'); }); $scope.$apply(); }; if ($scope.isAuth == true) { $scope.company = $localStorage.selectedCompany; $templateCache.removeAll(); $scope.getCompany($localStorage.selectedCompany.Id); } } ]); I have spend a lot of time, but still I don't understand why does only this contoller gets cached (other controllers were made via copy-paste).
But when this method is called for the first time: all is ok, in debugger I see that it goes to server via GET method, but when I refresh the page, and then go again to this controller - in Firefox and IE I see that there are no new requests to the server. But why? Only when I refresh the page with Ctrl + F5 all is ok. But users will do not do that, I need working application...
Maybe somebody knows how to fix this issue? How to disable angularjs view and controller caching?
UPD: I see that after update my localstorage isn't changing in IE and Firefox. Why?
getisn't called? Also where is the code forcheckAuthStatus()?