Angular2 return true/false with subscription
<p>I need to check if user exists in the database and return true if so. I have a function (i am using firebase by the way):</p>

<pre><code>  checkIfUserExists(login: string): boolean {
    this.af.database.list('/users', {
      query: {
        orderByChild: 'login',
        equalTo: login
      }
    }).subscribe(response =&gt; {
      if(response.length === 0 ) return true
    })
    return false
  }
</code></pre>

<p>The problem is that the function always returns false. It does not wait for checking subscription. Is there some way to fix it?</p>