title: how to get data from service in angular 2?
body: <p>I am able to get data using http (in a same component ) .But I am not getting data using service.can we call service method and grt data from server and display on component ?
  I try to make service and try to get data from server .But I am not able to know how to use this service ?
  <a href="http://plnkr.co/edit/hfhY6EdLVNOLP6d4QsWP?p=preview" rel="nofollow">http://plnkr.co/edit/hfhY6EdLVNOLP6d4QsWP?p=preview</a></p>
  
  <pre><code>import {Component, Injectable,Input,Output,EventEmitter} from 'angular2/core'
  import {Http, HTTP_PROVIDERS} from 'angular2/http';
  import 'rxjs/add/operator/map';
  // Name Service
  export interface myData {
     name:Array;
  }
  
  
  
  @Injectable()
  export class SharedService {
    sharingData: myData=[{name:"nyks"}];
     constructor(private http:Http) {
      }
    getData:Array()
    {
      this.sharingData.name=this.http.get('data.json')
          .map(res =&gt; res.json());
  
      return this.sharingData.name;
    }
  } 
  </code></pre>