Reputation: 17
Im getting this error:
ERROR NullInjectorError: R3InjectorError(Standalone[_LoginComponent])[HttpClient -> HttpClient -> HttpClient -> HttpClient]:
NullInjectorError: No provider for HttpClient! in angular.
[package.json[app.module.ts[login.component.ts]
I don't know what I am doing wrong. Do I have to import or provide HttpClient
somewhere else or in my Login component? I tried to provide it in my component and then i get the same error message but it says that there is no provider for HttpHandler
.
Upvotes: 0
Views: 3420
Reputation: 58174
Since login.component
is standalone, you need to import HttpClientModule
to the imports
array!
ERROR NullInjectorError: R3InjectorError(Standalone[_LoginComponent])[HttpClient -> HttpClient -> HttpClient -> HttpClient]: NullInjectorError: No provider for HttpClient! in angular.
If login.component
is a standalone component, then it should not be present in the declarations
array of any module! it should be in imports
array!
Upvotes: 1