title: Get array element in observable at particular index [Typescript]
body: <p>I am running an ionic3 app with Angular4 and angularfire2-Firestore. </p>
  
  <p>How does one go about getting a single object from an Observable. I am looking to return in typescript.</p>
  
  <pre><code>console.log(this.opportunity.title)  //   "Title1"
  </code></pre>
  
  <p>In the code below I am using the getOpportunityByIndex() method with index as the parameter. I am getting the following output and I'm not sure what to do next.</p>
  
  <pre><code>Observable {_isScalar: false, source: Observable, operator: MapOperator}
      operator:MapOperator {thisArg: undefined, project: ƒ}
      source:Observable {_isScalar: false, source: Observable, operator: MapOperator}
      _isScalar:false
      __proto__:Object
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>export interface Opportunity { title: string;  }
  export interface OpportunityId extends Opportunity { id: string; }
  
  opportunities: Observable&lt;OpportunityId[]&gt;;
  
    constructor( public firebaseProvider: FirebaseProvider)   {
      this.opportunities = this.firebaseProvider.getOpportunities();
    }
  
    getOpportunityByIndex(index: number) {            
       this.opportunity = this.opportunities.map(arr =&gt; arr[index]);
       console.log(this.opportunity.title);
      }
  }
  </code></pre>
  
  <p>FirebaseProviderService</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';
  import { Observable } from 'rxjs/Observable';
  import 'rxjs/add/operator/map';
  
  export interface Opportunity { title: string;  }
  export interface OpportunityId extends Opportunity { id?: string; }
  
  @Injectable()
    export class FirebaseProvider {    
    private opportunitiesCollection: AngularFirestoreCollection&lt;OpportunityId&gt;;
    opportunity: Opportunity
  
    constructor(afs: AngularFirestore) {
      this.opportunitiesCollection = afs.collection&lt;Opportunity&gt;('opportunities');
      this.opportunities = this.opportunitiesCollection.snapshotChanges().map(actions =&gt; {
        return actions.map(a =&gt; {
          const data = a.payload.doc.data() as Opportunity;
          const id = a.payload.doc.id;
          return { id, ...data };
        });
      });
    }
  
     getOpportunities() {
      return this.opportunities;
    }
  }
  </code></pre>