I am upgrading my Angular-2 project to Angular-12 project and when I changed :
Before
import { Http, Response, Headers } from '@angular/http';
After
import { HttpClient, HttpResponse, HttpHeaders } from '@angular/common/http';
I am facing issue to use HttpHeaders in place of Headers You can see the images below. I am stuck here. Need some help.
CodePudding user response:
The problem is that you set body
in a GET
request which has no body!
You can use this code below, but you will have to change your backend to use queryParams
:
this.http.get('myurl', { params: dataObject })