Skip to content

Instantly share code, notes, and snippets.

@BnayaZil
Last active June 5, 2019 10:33
Show Gist options
  • Save BnayaZil/eb79e23dc8c4238027a6b115a76c373c to your computer and use it in GitHub Desktop.
Save BnayaZil/eb79e23dc8c4238027a6b115a76c373c to your computer and use it in GitHub Desktop.
Get request using Angular httpClient
//http://localhost:8080/GetPlayers?playerID=IHS
const params = new HttpParams().set('playerID',playerid)
const headers = new HttpHeaders({
'Content-Type': 'application/json'})
return this.http.get<{message: string, player : Player}>(`http://localhost:8080/GetPlayers`, {params, headers}).subscribe(
(res) => console.log(res),
(err) => console.error(err)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment