title: How can I get data twice from Observable
body: <p>I need to get data after the request in the service and in the component. I found a way, only through the direct extraction of the variable from service through the <code>subscription.add method.</code></p>
  
  <p><strong>Service Code:</strong></p>
  
  <pre><code>itemList: any[];
  constructor(private http: HttpClient){}
  getData(){
    return this.http.get('items.json').subscribe(data =&gt; {
      this.itemList = data['itemList'];
    });
  }
  </code></pre>
  
  <p><strong>Component Code:</strong></p>
  
  <pre><code>items: any[];
  constructor(private dataService :DataService) { }
  ngOnInit() {
  }
  getItems() {
    this.dataService.getData().add(data =&gt; { 
      this.items = this.dataService.itemList;
  });
  }
  </code></pre>
  
  <p>Is there a way to do this through a re-subscription or something similar
  ,since if you try to extract the data in the add block it goes out indefined</p>
  
  <pre><code>add(data =&gt; { 
    this.items = data['itemList'];
    console.log(data);
  });
  </code></pre>