title: Angular return value from subscribe
body: <p>I need to return a value from the subscribe of a service call. Here is my code:</p>
  <pre><code>export class RideDataSource extends DataSource&lt;any&gt; {
  
    rides: Ride[];
  
    constructor(private _rideService: RidesService,
                private _paginator: MatPaginator) {
      super();
    }
  
    connect(): Observable&lt;Ride[]&gt; {
  
  this._rideService.getActiveRides(this._paginator.pageIndex, this._paginator.pageSize).subscribe(
        ridePage =&gt; {
          this.rides = ridePage.content;
          this._paginator.length = ridePage.totalElements;
        }
      );
  
      // i need to return  Observable.of(this.rides);
    }
  
    disconnect() {
      // No-op
    }
  
  }
  </code></pre>
  <p>Returning <code>Observable.of(this.rides)</code>  won't work as <code>this.rides</code> will be <code>undefined</code>. Is there any way to do this?</p>