Leaflet JS Ionic


#1

Hello!

I’ve been trying to add leaflet to my Ionic application. But as I understand several people are having trouble with this. Specifically that the CSS file doesn’t get imported right. This is turn makes the map broken with tiles not showing right.

I’ve been trying the npm install, both leaflet and @types.
Importing directly to both my mapPage and/or the index.html file with leaflet directly in assets folder. Both with and without the npm installed.
The @import / sass.config.js file.

This is basically what I’ve found on the net. When it feels like it gets the CSS file, the whole page just gets blank. I’m out of ideas now and just removed everything leaflet-related. I hope someone out there is the saviour I need!

/Daniel


#2
  • And removing and adding android platform while doing this.

#3

For anyone having a similiar issue. I solved it. I started a new project and followed this guide. http://tphangout.com/ionic-3-leaflet-maps-geolocation-markers/

It worked!

Then I removed everything Leaflet related in my real project and implemented this. Still works. Why, I don’t know. Seems like leaflet @types package damaged everything.