I'm fairly new to angular 2 and am trying to make an http request with headers.
I've been following a tutorial, that may be out of date, as I'm getting an error when trying to include Headers.
I'm importing the Headers module:
import { Http, Headers } from '@angular/http';
Here is my method, where I try to include the headers:
memberInfo(){
let headers = new Headers().set('Authorization', this.authToken);
this.http.get(this.API_ENDPOINT + '/memberinfo', { headers });
}
I get the following error:
[ts]
Argument of type '{ headers: void; }' is not assignable to parameter of type 'RequestOptionsArgs'.
Types of property 'headers' are incompatible.
Type 'void' is not assignable to type 'Headers'.
Any insight would be great!!
{ headers }to{ headers: headers }.