Issue
My code is migrated to angular standalone 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.
Solution
Since App Component is a standalone component, you can simply add the AppModule to the imports array of AppComponent.
@Component({
...
standalone: true,
imports: [AppModule]
...
})
export class App {
...
Also ensure that in the provideHttpClient
you are giving this
import { provideHttpClient } from '@angular/common/http';
bootstrapApplication(App, {
providers: [provideHttpClient()]
});
Ensure you have loginService added to the providers of either App Component
this might fix your issue!
Answered By - Naren Murali
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.