title: How to add Toastr inside http catch function?
body: <p>I am having trouble trying to figure out how to have toastr inside my handlerError function. When I run it the error I receive is </p>
  
  <blockquote>
    <p>'error' of undefined</p>
  </blockquote>
  
  <p>Here is my code </p>
  
  <pre><code>private handlerError(error: any) {  
  
    var  errorMessage = 'Server error';
  
    this.toastrService.error(errorMessage); &lt;-- This doesn't work
  
    return Observable.throw(errorMessage);
  }
  </code></pre>
  
  <p>it is being called like </p>
  
  <pre><code>post(url, data): Observable&lt;any&gt; {     
      this.toastrService.error('hey'); // &lt;-- This works
  return this.http.post(CONSTANT.API_URL + url, data, {
    headers: this.createAuthorizationHeader()
  }).
      map((res:Response) =&gt; { return this.toCamel(res.json()) }).
      catch(this.handlerError);
  }
  </code></pre>
  
  <p>Toastr is being injected</p>
  
  <pre><code>constructor(private http: Http, private toastrService: ToastrService) {}
  </code></pre>