Angular, communicate between modules
<p>I have fallowing setup for my project:</p>

<ul>
<li>mainApp main angular module, containing EventBus factory</li>
<li>app1 first module with mainApp injected</li>
<li>app2 second module with mainApp injected</li>
</ul>

<p>app1 and app2 are two modules placed on the same page, both have mainApp injected.</p>

<p>I am trying to communicate between app1 and app2 using EventBus factory, which is defined in mainApp. 
Unfortunately, I can't get it to work (app1 doesn't catch app2 event, and opposite).</p>

<p>How should I resolve that? Have I take a wrong approach?</p>

<pre><code>EventBus.subscribe("App1Ctr.event", function (event, data) {
    console.log("App2handler");
    $scope.name = data.newVal;
});


$scope.fireEvent = function () {
    EventBus.broadcast("App2Ctr.event", {"newVal": "App2Ctr"});
};
</code></pre>

<p>Here is a <a href="https://plnkr.co/edit/ZpdmdOvHve3y0OsF2nON?p=preview" rel="nofollow">plnkr</a></p>