Reputation: 6847
I'm pretty new to Angular 2, and looking for steps involved in setting up Leafletjs with Angular 2. Looking to avoid including JS and CSS into my index.html. It should not be imported globally, as I'm building a widget.
Any help at all would be very appreciated.
Upvotes: 2
Views: 4351
Reputation:
Begin with installing the package using
npm install leaflet --save
when you are in your root folder of the project.
I you want Leaflet as a global package:
When package is installed you should be able to enter the path's for the style and script files found under node_modules/ in angular-cli.json under the sections: "styles": []
and "scripts": []
You can read more about this at the angular-cli project page.
If you want to import the package into a existing module
On the top of your module write:
import leaflet from 'leaflet';
Upvotes: 4