AngularJS - Communication Between Controllers

This is an example of how to use a custom service to facilitate communicate between multiple controllers using $rootscope as an event bus.

by mkdskd

HTML

<script src="http://code.angularjs.org/angular-1.0.0rc9.js"></script>
<div ng-controller="ControllerZero">
    <button ng-click="has && handleClick(message);">LOG</button>
</div>

JavaScript

var myModule = angular.module('myModule', []);

function ControllerZero($scope) {
    $scope.has = false;
    $scope.handleClick = function (msg) {
        alert(msg)
    };
}