como enviar uma solicitação de postagem usando http de @ angular / http
Estou usando o código a seguir para enviar uma solicitação de postagem
import { Http, Headers, Response } from '@angular/http';
@Injectable()
export class AuthenticationService {
private _options = new Headers({'Content-Type': 'application/json'});
constructor(private http: Http) { }
login(username: string, password: string) {
return this.http.post('http://localhost:56451/map',
{ "username": username, "password": password },
this._options);
}
}
no entanto, estou recebendo o seguinte erro no vscode
Argument of type '{ headers: HttpHeaders; }' is not assignable to parameter of type 'RequestOptionsArgs'. Types
of property 'headers' are incompatible. Type 'HttpHeaders' is not assignable to type 'Headers'. Property 'forEach'
is missing in type 'HttpHeaders'.
Ajude a esclarecer os conceitos associados