Answers for "how to add http params in angular"

2

how to get http request and store the response in a variable in angular

this.http.get("https://reqres.in/api/users/2").subscribe(data => {
  console.log(data);
  this.values = data;
}
Posted by: Guest on June-14-2021
5

angular http request query params

request(query) {
  let params = new HttpParams().set("keyword", query);
  return this.http.get(`Your_URL`, {params});
}
Posted by: Guest on November-22-2020
0

How to create and access angular HTTP params in PHP

//Crreating HTTP params
//e.g. http://localhost/api/something.php?title=value&content=value
let httpParams = new HttpParams()
  .set('title', this.createNewForm.controls['title'].value)
  .set('content', this.createNewForm.controls['content'].value);

//Then pass the Http params object to the http.get) method
this.http.get('http://localhost/api/something.php', {httpParams}).then();

//Accessing these parameters in PHP
$title = $_GET['title'];
$title = $_GET['content'];
Posted by: Guest on October-17-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language