title: How to use Response of one In another method typescript without ID value
body: <p>from the service response, need to get that in ngOnit function of another component but don't have <strong>ids</strong> in that typescript</p>
  
  <p>Here <strong>ids</strong> means </p>
  
  <pre><code>detailvisit(visit: Visit) {
       const ids = {
        'ID': visit.ID,
        'patientid': visit.pid,
      };
      this.visitService.getavisit(ids);
      this.router.navigate(['/detailvisit']);
    }
  </code></pre>
  
  <p>Service for get a record </p>
  
  <pre><code>getavisit(ids): Observable&lt;Visit&gt; {
      const headers = new Headers({ 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + this.authenticationService.token });
      const options = new RequestOptions({headers: headers });
    return this.http.post('/api/getvisit/', JSON.stringify(ids), options)
    .map((response: Response) =&gt; {
                     return &lt;Visit&gt;response.json();
              });
  </code></pre>