angular-leaflet-directive
angular-leaflet-directive copied to clipboard
Dynamic Layer Addition Problem
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.
html = "
"