toutpt / angular-leaflet-light

angular <leaflet> directive that is just leaflet
http://toutpt.github.io/angular-leaflet-light/
14 stars 4 forks source link

Angular Leaflet Light

NPM

Travis CI Codacy Badge semantic-release Commitizen friendly

Quality Coverage Status Circle CI

dependencies devdependencies

A simple directive for displaying a Leaflet map in AngularJS, providing a callback with the map object.

Examples

Example 1: Default Source

Example 2: sync center&zoom Source

Example 3: geojson Source

Installation

Install using npm:

npm install --save angular-leaflet-light

Add angular-leaflet as a dependency for your app:

angular.module('MyApp', ['angular-leaflet']);

Use it as so:

<leaflet></leaflet>

Extending:

A simple service adds some common utils to handle things like compiling popup with your data from the scope + default settings for all leaflet maps. Callback is used at initialization so it doesn't need a watcher.

<leaflet id="mymap" on-map-initialized="customizeMyMap(map)"></leaflet>

You can also access the map using the service, note map id "mymap":

leafletService.data.mymap;

Comparing to alternatives

The first integration of leaflet in angular has been done by David Rubert aka tombatossals:

https://github.com/tombatossals/angular-leaflet-directive

Later own that project got forked by some actives and is now maintained by angular-ui team:

https://github.com/angular-ui/ui-leaflet

So why should I do it again? Because both provide something that is not leaflet.

Theses projects provides advanced integration into angular but:

License

MIT