Menahem Gil
Menahem Gil

Reputation: 829

Can't find @angular/common/http on stackblitz

I try to create a new service file on Stackblitz, for some reason I get an error message: Can't find module '@angular/common/http'

Same with 'rxjs/Observable'; any idea why? It uses now Angular 6.

I have the @angular/http under npm packages

Thanks.

Upvotes: 1

Views: 1457

Answers (1)

Ploppy
Ploppy

Reputation: 15353

You need to add the @angular/http package to the dependencies. enter image description here

Then in your main module:

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

@NgModule({
  imports: [ ..., HttpClientModule],
  ...
})

It's rxjs 6, imports are simplified:

import { Observable } from 'rxjs'

Upvotes: 4

Related Questions