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
Post a Comment