Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230497

Unexpected value 'HttpClient' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation

$
0
0

I think there is some confusion here, perhaps due to the word “import” being used to describe two totally different things:

  1. The JavaScript import statement, used to combine code from different compilation units, much as the #include directive works in C.
  2. A property of NgModules named imports, which indicates which Angular modules reference one another for lazy loading purposes.

OP was asking about usage #1, which I said (and still believe) is not relevant to the error message. You seem to be talking about usage #2.

At the time this thread was created, I believe the proper place for putting HttpClient in an app module was providers. It definitely wasn’t declarations, which is for components.

In that spirit, the proper thing to do today is add HttpClientModule to the imports section of your AppModule.


Viewing all articles
Browse latest Browse all 230497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>