title: Cannot read property 'next' of undefined
body: <p>I'm subscribing to an observable so that anytime my <code>subscribeToTasks()</code> call in my service fails, it will ultimately invoke the code in my <code>subscriptionError()</code> method from my component,  which in this example is just a simple alert. The problem is, anytime an error on this call occurs and <code>this.newSubscriptionFailure.next()</code> gets invoked, I get the following error in my browser console:</p>
  
  <blockquote>
    <p>Cannot read property 'next' of undefined</p>
  </blockquote>
  
  <p>How is <code>newSubscriptionFailure</code> undefined when you can clearly see it being defined above the method? That code should get hit long before the error in the api call happens. I've used this approach in the past and it has always worked, the only difference I can think of is that I'm calling <code>.next()</code> in the service (same file that <code>newSubscriptionFailure</code> is defined) whereas I normally call <code>.next()</code> in a separate component file. What am I doing wrong? Is there a way I can get this to work, or a better approach to take?</p>
  
  <p><strong>Code from my service:</strong></p>
  
  <pre><code>import { Observable } from 'rxjs/Observable';
  import { Subject }    from 'rxjs/Subject';
  
  public subscribeToTasks(period: string, stripeToken: string): Observable&lt;any&gt; {        
      let body = JSON.stringify({ period, stripeToken });
      let headers = new Headers({ 'Content-Type': 'application/json' });
      let options = new RequestOptions({ headers: headers });        
      return this.authHttp.post(this.apiTasks, body, options).map(response =&gt; {
          return response.json();
      }).catch(this.newSubscriptionError);
  }
  
  
  newSubscriptionFailure = new Subject();
  newSubscriptionFailure$ = this.newSubscriptionFailure.asObservable();
  
  public newSubscriptionError() {
      this.newSubscriptionFailure.next();
  }
  </code></pre>
  
  <p><strong>code from my component:</strong></p>
  
  <pre><code>ngOnInit(): void {
      this.subscriptionError();
  }
  
  subscriptionError(){
      this.subscriptionsService.newSubscriptionFailure$.subscribe(() =&gt; {
          alert('call failed');
      });
  }
  </code></pre>