title: Api call from angular 2 not working at first time
body: <p>Hi I am very new in angular, I am calling an API from angular service but at first hit, it directly goes to catch and in subscribe, data is coming like the Unexpected end of input , but after few minutes it is hitting the API and extractData method is also getting hit with specific successful json:
  service:</p>
  
  <pre><code>  getUsers(userName: string, password: string): Observable&lt;any&gt; {
      debugger;
      return this._http.get("http://localhost:51802/Login?userName=" + userName + "&amp;password=" + password)
          .map((this.extractData))
          .catch(this._errorHandler);
  
  }
  
    private extractData(res: Response) {
          return res.text() ? res.json() : {};
      }
      _errorHandler(error: Response) {
          console.error(error);
          return Observable.throw(error || "Server Error");
      }
  </code></pre>
  
  <p>component:</p>
  
  <pre><code> public loginUsers(loginId: string, password: string) {
          console.log(this.loginForm);
          if (this.loginForm.valid) {
              this._loginService.getUsers(loginId, password).subscribe(data =&gt; this.users = data);
             // this.users = this._loginService.getUsers(body);
              console.log('form submitted');
             // this.router.navigateByUrl('index');
          } else {
              this.validateAllFormFields(this.loginForm);
          }
      }
  </code></pre>