How can I reproduce this example with the angular Leaflet directive? I understand the example, but when I apply the last line of the example source
L.control.layers(baseLayers, overlays).addTo(map);
that I had to adjust to
L.control.layers(baseLayers, overlays).addTo($scope);
Because all map properties are in $scope now...?
angular.extend($scope,{
defaults: {
layers: [streetLayer,sateliteLayer,oceanLayer],
maxZoom: 16,
zoomControl: false,
doubleClickZoom: true,
path: {
weight: 10,
color: '#800000',
opacity: 1
}
}
});
I get
TypeError: this._map.on is not a function
at o.Control.Layers.o.Control.extend._initLayout (leaflet.js:9)
at o.Control.Layers.o.Control.extend.onAdd (leaflet.js:9)
at o.Control.o.Class.extend.addTo (leaflet.js:9)
at new <anonymous> (mapController.js:135)
at invoke (ionic.bundle.js:12884)
at Object.instantiate (ionic.bundle.js:12892)
at ionic.bundle.js:17161
at self.appendViewElement (ionic.bundle.js:48243)
at Object.switcher.render (ionic.bundle.js:46441)
at Object.switcher.init (ionic.bundle.js:46361)