I am trying to use HttpClient in angular 6 in my service as follows:
auth.service.ts
constructor(private http: HttpClient, public dataService: DataService, private config: AppConfig) {
console.log(this.config);
}
This http:HttpClient is the reason I am getting the following error. When I remove this, the error goes. I am not sure why this error is coming.
core.js:1521 ERROR TypeError: Cannot read property 'length' of null
at http.js:108
at Array.forEach (<anonymous>)
at HttpHeaders.lazyInit (http.js:102)
at HttpHeaders.init (http.js:166)
at HttpHeaders.forEach (http.js:235)
at Observable._subscribe (http.js:1445)
at Observable._trySubscribe (Observable.js:42)
at Observable.subscribe (Observable.js:28)
at subscribeTo.js:21
at subscribeToResult (subscribeToResult.js:6)
app.module.ts.import { HttpClient } from 'selenium-webdriver/http';import { HttpClient, HttpParams, HttpRequest } from "@angular/common/http";HttpClientModule