Hi
I have written a directive in which on destroy event i need to call some AJAX request and I want my destroy event to wait for the AJAX call to finished.
Here is my code.
scope.$on('$destroy', function() {
callmethodAsync("").always(function() {
// Do some cleanup or logging
console.log('inside remember');
});
});
Here i want my destroy method to wait for asyn method execution. How I can achieved that.