0

How to get data from below HTTP request.

srp/dashboard/graphics-chart/v1/{roleId}.

In webservice.url.ts I decalred a variable ang assigned the URL to it.

dashboardbardata : 'srp/dashboard/graphics-chart/v1/'.

there is already get req done below is code and file name is apiservice.ts

 get(path: string, params: HttpParams = new HttpParams()): Observable<any> {
return this.http.get(`${environment.api_url}${path}`, { params })
  .pipe(catchError(this.formatErrors));

}

How to use the above HTTP request in my service file and how to subscribe it in TS file.

4
  • You asked a similar question a couple of hours back: stackoverflow.com/q/60374366/6513921. How is this any different? Also please reformat the question. Your primary question is still unclear. Commented Feb 24, 2020 at 13:04
  • Yeah but there is an error in the above question so I have asked another one. sorry if I have offended you. Commented Feb 24, 2020 at 13:07
  • 1
    there is an error - could you please elaborate? Commented Feb 24, 2020 at 13:11
  • Does this answer your question? How to use below HTTP request to get data from server Commented Feb 24, 2020 at 15:39

1 Answer 1

1

in service webservice.url.ts

 public getData(roleId) {
    return this.apiService.get(roleId);
  }

in dashboard

 service.getData(roleId).subscribe((res: any) {
// your code

});
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.