Class: LeafletService

LeafletService

Class LeafletService which provide API to let leaflet work well with AngularJS You can pass settings throw the provider

new LeafletService($compile)

LeafletService constructor
Parameters:
Name Type Description
$compile Object angular $compile
Source:

Methods


on(event, callback, leafletObject, scope)

integrate Leaflet map.on function with angular most of the work consist to call scope.$apply only if needed
Parameters:
Name Type Description
event String the name of the event to listen like 'click' You will find all supported event on the http://leafletjs.com/reference.html#
callback function the function to call when this event happens
leafletObject Object the object that has '.on' function
scope Ojbect the scope of your current controller/directive/component
Source:

updateMapFromSettings(map, settings)

integrate Leaflet map.on function with angular most of the work consist to call scope.$apply only if needed.
Parameters:
Name Type Description
map Object the leaflet map object update
settings Object
Source:
Example
var settings = {
        center: {
            lat: 47.184112659842015,
            lng: -1.619110107421875,
            zoom: 17
        },
        minZoom: 12,
        maxBounds: [[47.143496,-1.652756],[47.296462,-1.461868]]
        tiles: {
            url: 'http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
            options: {
                attribution: '&copy; Openstreetmap France | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
                maxZoom: 19
            }
        },
        layers: {
            baselayers: {
                layerid: {}
            },
            overlays: {
                overlayid: {}
            }
        }
     };