If you use HttpClient on the component itself, you can use @Component({..., import:[HttpclientModule,…]...});, but seeing your code, I believe you are using HttpClient on the injected service and not inside the component itself.
Editing main.ts is not a good idea since it is Ionic source, hence you will need to merge your changes the next time Ionic update it (or it may get over ridden and your changes will be gone).
We’re currently facing this issue as well, if you have other ideas or someone from Ionic can respond with the recommended solution to handle this I’d greatly appreciate it. In any case we’ll post here once we find an acceptable solution.
hi @mic2 i tried to import the module directly into the component, but still had problems, I could only solve it by providing the httpClient from the main.js, it makes a bit of sense because it also provides the routes and some other modules can be provided from here, I don’t know if It is the best way and hopefully someone from the ionic team can answer how to correct this and have good practices. For now this works for me and I’ll leave it at that. thank you!
Found this migration guide by Ionic team from November 22. It seems they too update main.js to support providers on “global” level.
If someone from Ionic read this, please confirm this is still the recommended way. In general I would expect to have a location in which we can register providers which would be passed to bootstrapApplication.