Hi Rahul,

You can't wait there. The function will get destroyed as soon as it runs to 
completion.  However, you can take the function you need out of the current 
event loop, and elevate it to the next using setTimeout. (or, if you need 
to update anything on screen use the $timer) You can do that like this:

scope.$on('$destroy', function () {
setTimeout(function anonymous() { // When the function eeds to change 
something in the $scope, use $timer instead
callmethodAsync("").always(function () {
// Do some cleanup or logging
console.log('inside remember');
});
}, 0)
});

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to