Is there a good way to manage all events fired on $ rootScope so that you don't end up with events with the same name?
2 answers
The easiest way to do it: just write your own wrapper that will log events
This is just an example of an idea
angular.service("EventManager", function($rootScope){
var events_names = {};
return {
on: function(name, cb){
if(!events_names[name]){
$rootScope.$on(name, cb);
}
else{
console.error("This kind of event already defined!", name);
}
}
}
});
+3
source to share