title: Angular 2 passing value from service to component
body: <p>Function inside service:</p>
  
  <pre class="lang-js prettyprint-override"><code>getUserInfo() {
    this.af.authState.subscribe(authData =&gt; {
      let email = authData.email;
      let array = this.database.list('registeredUsers', {
        query: {
          orderByChild: 'email',
          equalTo: email
        }
      }).subscribe(data =&gt; {
        let userFName = data[0].firstName;
      });
    });
  }
  </code></pre>
  
  <p>Component:</p>
  
  <pre class="lang-js prettyprint-override"><code>ngOnInit() {
      this.afService.getUserInfo();
  }
  </code></pre>
  
  <p>The function itself works great, but how do I pass the <code>let userFName</code> variable to be used within the component?</p>