angular-leaflet-directive icon indicating copy to clipboard operation
angular-leaflet-directive copied to clipboard

Dynamic Layer Addition Problem

Open robohal opened this issue 9 years ago • 2 comments

Firstly, thanks for the awesome directive. I am building an app for querying imagery and this has been a big help. I am having some issues with layer control using the code found here. I have tried to follow the example, but just cant seem to get it. I keep getting a console error of ```

ionic.bundle.js:26771 TypeError: Cannot read property 'baselayers' of undefined at Scope.$scope.toggleLayer (mapController.js:69)

The code that it is referencing is below:

$scope.toggleLayer = function(layerName) { var baselayers = $scope.layers.baselayers; if (baselayers.hasOwnProperty(layerName)) { delete baselayers[layerName]; } else { baselayers[layerName] = $scope.definedLayers[layerName]; } };

I basically have a button in the app html that calls the above function in order to change the tilecache from osm to a custom tilecache.  The html is below:
Appreciate any help in working this out.

robohal avatar May 12 '16 02:05 robohal

html = "

"

robohal avatar May 12 '16 02:05 robohal

robohal avatar May 12 '16 02:05 robohal