Angular2 - HTTP RequestOptions HEADERS
Update
As of today, @angular/http
has been deprecated, and @angular/common/http
should be used instead. So the best way to work with http headers is to import import { HttpHeaders } from '@angular/common/http';
(documentation).
Old answer
The Headers
type you are supposed to import is import { Headers } from '@angular/http';
.
Check your imports
You have to update headers by:
let headers = {headers: new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded'})};
Update for Angular 5
import { RequestOptions } from '@angular/http';
I found this in the comments from the correct answer, so If this helps somebody, good luck.
Documentation: https://angular.io/api/http/RequestOptions