title: Wait for Observable to complete in order to submit a form
body: <p>I have a 'new trip' form, where the user can write the names of the participants and then submit the form to create the trip.
  On submit, I query a Firebase database with the names, in order to get the IDs of the participants (/users). I then add the IDs to the <code>participantsID</code> field of the trip object and then I push the new trip to Firebase.</p>
  
  <p>The problem is that the Firebase query is async and returns an Observable, therefore my function will proceed to push the object before the Observable has completed, so the participantsID field of the new object is empty.</p>
  
  <p>Is there any method to wait for the observable to complete (in a kind of synchronous way) so that i can manipulate the data and then proceed? All my attempts to fix this have failed so far.</p>
  
  <p>Here's my simple code.</p>
  
  <pre><code>getUserByAttribute(attribute, value) {
    return this.db.list('/users', {
      query: {
        orderByChild: attribute,
        equalTo: value,
        limitToFirst: 1
      }
    });
  }
  
  createTrip(trip) {
    for(let name in participantsName.split(',')) {
      getUserByAttribute('username', name)
        .subscribe( user =&gt; trip.participantsID.push(user[0].$key) );
    }
  
    this.db.list('/trips').push(trip);
  }
  </code></pre>