Closed carrbrpoa closed 9 years ago
I checked it out, but how could I be using the "wrong $scope"?
Here's my main controller:
app.controller("MainController", [ "$scope", "$rootScope", "leafletData", function($scope, $rootScope, leafletData) {
var ctrl = this;
// My custom stuff
(...)
$scope.$on('cdl-loading-on', function(event, args) {
$scope.loadingCdl = true;
$scope.cdlNaoEncontrou = false;
});
$scope.$on('cdl-loading-off', function(event, args) {
$scope.loadingCdl = false;
});
// End of my custom stuff
$rootScope.$on('leafletDirectiveMap.baselayerchange', function(ev, layer) {
leafletData.getLayers().then(function(l) {
angular.forEach(l.baselayers, function(bl) {
bl.setZIndex(-1);
});
});
});
angular.extend($scope, {
defaults : {},
center : {
lat : -30.1,
lng : -51.18,
zoom : 12
},
controls : {
scale : {
metric : true,
imperial : false,
position : 'bottomleft'
},
fullscreen : {
position : 'topleft'
}
},
layers : {
baselayers : {
xyz : {
name : 'Open Street Map',
url : 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
type : 'xyz'
},
topo : {
name : "Topográfico",
type : "agsBase",
layer : "Topographic",
visible : false
},
(...)
Ok, well make an small concrete example. Via plnkr.
Here it goes: http://plnkr.co/edit/jyXgske9YXYRViqLamBc?p=preview
It's a simplified version of my app, without overlays. See that you just need to start switching the baselayers and in a while the error occurs.
Sometimes it just doesn't loads the selected baselayer due to the error (I guess).
So looking at the stack and running your example this appears to be a leaflet / leaflet esri problem. This seems to not be our issue. Please take it up with either of them.
Thanks. FYI, opened issue 3961 in leaflet.
I'm toggling between my available baselayers (with or without overlays) and sometimes this error comes:
And the line pointed in
BasemapLayer.js
is:Any ideas?
Thanks in advance