Trigger Refresher

I’m trying to figure out how to cause the refresher to trigger programatically. For example, a user does something that updated the backend. I need to trigger a refresh.

I don’t see anything in the code for actually triggering the effect. I can imagine something like triggering a Gesture, but that code is over my head. Suggestions?


Never mind. I found the smarter way to do this. My model should be updating when the cache gets refreshed in my service. So, now that I’m properly doing this, my list updates automatically.

1 Like

Hi Calandee , can u provide a demo link for auto refresh of data from json without pull to refresh.
it has to update the value every 30 sec.

I’ve been using angular-cache and having the cache expire every 30 seconds. It supports an onExpire callback that lets me update the cache in the background. I use $rootScope.$broadcast in the cache call back to let my controller know there’s updated data. I then use $scope.$on to listen for that broadcast on my controller to let it know it needs to fetch new data.

Sorry, I know you asked @Calendee, but I wanted to share my 2 cents and possibly get feedback.



Thanks dear @compudaze could you share the demo in codepen.

If any one else has a option , could you plz share

The key here is that the refresher is not really responsible for this task. You controller &/or service should be doing this.

Here’s a VERY rough demo of doing this. Ideally, this should be done in a service instead of the controller as @compudaze suggested.

HI @Calendee , actually i’m loading a data from json using

	function TeamsCtrlAjax($scope, $http)
	$http({method: 'POST', url: 'js/teams.json'}).success(function(data) {
	$scope.teams = data;

if i update my json data , it has to be reflected in the client side.

Any suggestions ,?

Thanks in advance

And that should work just fine like in my example.

However, I think I see your problem. You are not using “dot notation”. Try changing $scope.teams = data to $ = data and then updating your binding in your HTML.