maplibre / ngx-maplibre-gl

Angular binding of maplibre-gl
https://maplibre.org/ngx-maplibre-gl/
MIT License
73 stars 25 forks source link

Can we use MapService directly? #196

Open zelanter opened 2 days ago

zelanter commented 2 days ago

Hi,

documentation mentions MapService, and looking at MapComponent code, I understand how it uses that service internally. It's also a private property, but MapService itself is Injectable based on its code.

So I was hoping I could inject it in my components, but when I do so (I need to manually add it to providers) it's not the instance that the component is using internally for sure, so I was wondering if there is any way to "tap" into that mapService the component is using, as it doesn't seem to be exposed.

Since it's part of the API, I assumed it's meant to be used, so if that's really the case, the question remains: how?

I guess I could just manually assign the instance to it, but then I'd check if there is any added value compared to simply using the instance directly. Would the benefit be that we remain in the "Angular zone" and it's more consistent if we do map operations using it instead of the mapInstance directly?

HarelM commented 1 day ago

I'm not sure it is meant to be used, probably needs to be "internal" in the docs. The original docs didn't have it exposed, I rewrote three docs using typedoc so I might have forgotten to mark it internal.