Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to register Http Client #16

Open
kiebor81 opened this issue Aug 24, 2024 · 3 comments
Open

Unable to register Http Client #16

kiebor81 opened this issue Aug 24, 2024 · 3 comments

Comments

@kiebor81
Copy link

kiebor81 commented Aug 24, 2024

app.config.ts doesn't exist in the project and adding the provideHttpClient() function to maint.ts doesn't apply. Platform browser config on the app module is overriding. Is there any reason why this project is configured so strangely? is the pro version the same or is it configured to use Angular 18 bootstrapping, injection and standalones correctly?

Otherwise, can you explain how to provide a service into the login/register component? Globally provided won't work without http functionality.

@kiebor81
Copy link
Author

kiebor81 commented Aug 25, 2024

The problem appears to be tha you are using a combination of legacy modules and standalone components. We can provide services to the components directly, but anything extending on or leveraging HttpClient will require the HttpClient be provided at the root for global configuration. This can't be done in the appmodule as it is ignored by standalones, and likewise, because you haven't configured the project to bootstrap app.component as a a standalone, the other configurations of appmodule are localised to the platform configuration.

I wanted to use the free version as a proof of concept in order to secure funding for the pro version. Can you confirm the pro version is configured correctly? Or otherwise upgrade the free version with instructions on how to use HttpClient?

Thanks

https://stackoverflow.com/questions/77163778/angular-standalone-app-nullinjectorerror-no-provider-for-httpclient

@kiebor81
Copy link
Author

The solution is to add the global provider for HttpClient in the appmodule along with an import for HttpClientModule, and to additionally provide each service again into the standalone component.
imports
standalone

This is anti-pattern, but functional. Can you let me know if the pro template has the same quirk

@phoenixcoded20
Copy link
Contributor

This will be fixed in an upcoming version. All the components will be standalone. We are gradually migrating this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants