javascript - AngularJS perform action after $scope.emit -


i need perform action after call $scope.emit(...) has finished processing (i.e. handlers/listeners have completed), how can that?

                    $scope.$emit("nserror:setpage", { page: page, ele: ele });// tell page directive set current page errored item visible                     alert('here'); 

currently, alert happens before ui updated correct page.

'$scope.$emit has finished' not same thing 'ui has updated'. ui updated, digest cycle must complete. can wait happen using angular's $timeout function (don't forget inject in controller):

$timeout(function(){alert('here');}); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -