title: Angular5: Return HttpClient response from a service to a Component?
body: <p>I currently learning Angular 5 and I'm having difficulty on passing data from a service to a component. I'm integrating this to wordpress..</p>
  
  <p>here's my current code:<br>
  <strong>orderers.component.ts</strong></p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { HttpClient, HttpHeaders } from '@angular/common/http';
  
  @Component({
      selector: 'app-orderer',
      templateUrl: './orderer.component.html',
      styleUrls: ['./orderer.component.css'] })
  
  
  export class OrdererComponent implements OnInit {
  
  o_manual:boolean = false;
  orderers = [];
  
  constructor(private http:HttpClient) { }
  
  ngOnInit() {
      this.get_users();
  }
  
  get_users() {
      this.http.get('http://angular5.localhost/wp-admin/admin-ajax.php?action=orderers').subscribe( data =&gt; { 
          this.orderers = data;
      }
  } }
  </code></pre>
  
  <p>how can i transfer get_user() to a service and return the data and pass it in  the component ?
  Thanks .. :)</p>