Broadcating event on button click :-
$scope.onButtonClick = function(){
$rootScope.$broadcast('onButtonClick');
}
And catching event in another controller :-
$rootScope.$on('onButtonClick',function(event){
alert("catched");
console.log(event);
});
But it caught twice even though it fired only once. Why is that?
$routeProvider
controller andng-controller
on the same view. – Kial