I think there is some confusion here, perhaps due to the word “import” being used to describe two totally different things:
-
The JavaScript
import
statement, used to combine code from different compilation units, much as the#include
directive works in C. -
A property of
NgModule
s namedimports
, 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
.