i m using ui router for state management. i have some directives that are behaving as listeners of some events
app.directive('signer', ['Constant', "GlobalService",
function (constant, globalService) {
return {
restrict: "A",
scope: {},
link: function (scope, element) {
var workflowLoaded;
workflowLoaded = scope.$on('event:workflowLoaded', function (data) {
globalService.performAction();
});
scope.$on('$destroy', function () {
if (workflowLoaded) workflowLoaded();
});
}
}
}]);
Scenario : user navigating from one view to other view that contains Signer directive which reloads the directive
Issue: when item.html loads it register for event, but as $destory called after $statechangesuccess it de-register the event.
how to resolve the issue, any help will be appreciated
they have discussed it here but i cant find the solution https://github.com/angular-ui/ui-router/issues/2485