title: How to pass data from one component to other in angular 2
body: <p>I have my login controller where i login and on success I get data to be displayed on home page. How do i pass this data to home component?</p>
  
  <p>this is the function in login Component</p>
  
  <pre><code> ngOnInit() {
    this.returnUrl = '/home';
    }
    doLogin(event) {
     // console.log(event);
     // console.log(this.loginForm.value);
     this.authenticationService.login(this.loginForm.value.username, this.loginForm.value.password)
     .subscribe(
     (response) =&gt; {
      console.log(response);
     if(response.authenticateResult==0){
      sessionStorage.setItem('user_token', response.user_token);
     console.log(response.project_list.projects);
      this.router.navigate([this.returnUrl]);
      }else{
  this.error = 'Please enter correct Username and password';
      }
     }
     )
    }
  </code></pre>
  
  <p>response.project_list.projects has list of projects which I want to display in home page. I am new to angular 2 . So I am not understanding how i can get access to the data which is in login component. Is there any way to access data from 1 component to other and process it according to that particular component?</p>