I'm new to Ionic2 and Angular2 with typescript and I want to build a mobile application for iOS and Android. As a next step I want to include a map and found Leaflet, to change easily between GoogleMaps and OSM, ...
So, my problems started with installing: There are different packages like npm install leaflet
or npm install leaflet-map
or npm install ui-leaflet
and many more..
Second, I have no idea how to include those packages then. Would be great, if someone could provide me a really simple basic app in Ionic2 showing a leaflet-map.
Ok.. First install leaflet and its typings
Then import leaflet to your Component or whatever with
In the html-file add a div with
id="map"
and a pre-set size (better do it via css).As
styleUrls: []
is still buggy in Ionic2, you also have to add the leaflet styles to your html-file:After this preparing you can start with the leaflet tutorial like this: