AngularJS and AJAX - angular is not updating / refreshing

if u'll try to make an AJAX based angluar app u'll run in a few problems of data not updating right.

thats becuz the $http.get/post runz async and ur controllers and direcitves finish their jobs, and even if u call them again sometimes its not enough.

so 1st thing is to use some broadcasting, in the service family there is $rootScope.$broadcast('eventName'); the controllers use  $rootScope.$emit('eventName'); and u can even send args with them.

then in the controllers / directives u should do this:

with DOM manipulation directives do:
scope.$root.$on('eventName', function(){
  $timeout(function () {

this is a kind of 'onDigestComplete'.


Popular posts from this blog

Asp.Net Ending Response options, Response.End() vs CompleteRequest()

c# Service Play Sound with NAudio example by Moshe

JS/JQ simulate Enter event