title: How do I create a publisher/subscriber model in Angular?
body: <p>I've been playing with Angular and have been trying to find a way to use a pub/sub mechanism across the whole component tree.</p>
  
  <p>It seems that EventEmitter is only emitting an event that can be subscribed to one level up - but not more. Similarly, it only emits the events up the tree but now down. </p>
  
  <p><a href="http://plnkr.co/edit/gputAG?p=info" rel="noreferrer">plunker</a> </p>
  
  <p>The relevant code is here:</p>
  
  <pre><code>class App {
    onAncestor($event) {
       console.log('in ancestor, decendent  clicked',$event);
    } 
  }
  
   ...
  class Entities {
     ....
     onParent($event) {
       console.log('in entities parent, child  clicked',$event);
     } 
  
     onGrandParent($event) {
        console.log('in grand parent, grandschild  clicked',$event);
     } 
  </code></pre>
  
  <p>}</p>
  
  <p>Only onParent is called, never onGrandparent or onAncestor.  Similarly it wont publish downwards either.</p>