title: Using Observable and Subscribe in Angular with Firebase
body: <p>I am trying to subscribe to an function returning observable object in angular 2 .
  So when there is any new worker added the main calling function should have the value </p>
  
  <p>// functiion based on firebase DB </p>
  
  <pre><code>getWorkers():Observable&lt;any&gt; {
      firebase.database().ref('/workers').on('child_added', (snapshot) =&gt; {
          return snapshot.val();
  
      });
  
  }
  </code></pre>
  
  <p>subscriber function </p>
  
  <pre><code>workers: any[];
  public ngOnInit() {
      this.db.getWorkers().subscribe(workers =&gt; this.workers = workers);
  }
  </code></pre>
  
  <p>It is saying the function return type is not Observable and hence throwing error .</p>