title: Property 'subscribe' does not exist on type 'void' in angular-cli
body: <p>I am new to angular 2 and didn't find any proper answer for similar questions posted.</p>
  
  <p>I am getting Property 'subscribe' does not exist on type 'void' in angular-cli. I tried importing subscribe from rxjs but didn't find that library.</p>
  
  <p><a href="https://i.stack.imgur.com/Ih10f.jpg" rel="noreferrer">Error Image</a></p>
  
  <p>please help solving this issue. please find below my service and component code into which i am calling that service.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// ******************************* 
  
  // login.service.ts
  
  // ******************************* 
  
  import { Injectable } from '@angular/core';
  import { Http, Response } from '@angular/http';
  import { Observable } from 'rxjs/observable';
  import 'rxjs/add/operator/map';
  import 'rxjs/add/operator/catch';
  import 'rxjs/add/operator/throw';
  
  @Injectable()
  export class LoginService {
  
    constructor(private http: Http) { }
  
    getLoginData(){
      this.http.get('./json/login.json')
        .map((result: Response) =&gt; result.json())
        .catch(this.getError);
    }
  
    private getError(error: Response): Observable&lt;any&gt;{
        console.log(error);
        return Observable.throw(error.json() || 'Server Issue');
    }
  
  }
  
  // ******************************* 
  
  // login.component.ts
  
  // ******************************* 
  
  
  import { Component } from '@angular/core';
  import { Router } from '@angular/router';
  import { LoginService } from '../login.service';
  
  @Component({
    selector: 'app-login',
    templateUrl: './login.component.html',
    styleUrls: ['./login.component.css'],
    providers: [LoginService]
  })
  export class LoginComponent {
  usernameModel: string;
  passwordModel: string;
  validLogin: Boolean;
    constructor(private router: Router, private loginService: LoginService) { }
  
    homeNav(){
      if(this.usernameModel === 'jay' &amp;&amp; this.passwordModel === 'Jay'){
        this.validLogin = true;
        this.router.navigate(['/home']);
      }
      else{
        this.validLogin = false;
        console.log('Login Error');
      }
  
  this.loginService.getLoginData()
    .subscribe(
      data =&gt; console.log(data)
    );
  
    }
  
  
  
  }</code></pre>
  </div>
  </div>
  </p>