Property ‘get’ does not exist on type ‘HttpClientModule’

You need to use HttpClient not HttpClientModule to make an http request.

In app.module.ts, import HttpClientModule (see “imports” below):

import { HttpClientModule } from '@angular/common/http';
@NgModule({
    imports: [
          HttpClientModule,
    ...
    ],
    ...
})
export class AppModule { }

Then, import HttpClient in app.component.ts:

import { HttpClient } from '@angular/common/http';

Now, change your AppComponent Ctor from

constructor(private http: HttpClientModule){};

to

constructor(private http: HttpClient){};

Leave a Comment

tech