Thursday, February 21, 2019

Unexpected module 'HttpModule' declared by the module 'ContractsModule'. Please add a @Pipe/@Directive/@Component annotation.

I got this error when I accidentally put HttpModule in the declarations metadata property for a module when really it goes in the imports. @angular/http does not come with Angular 7 when you make a new Angular 7 app from the Angular CLI. You need to install it like so at the command line:

npm install @angular/http

 
 

This will allow for looping in HttpModule at a module (at the imports) and Http, Headers, RequestOptions at the service where you have an implementation.

No comments:

Post a Comment