Angularjs 如何以编程方式在angular1中的ui传单地图上添加矩形
在HTML中,我的地图定义如下Angularjs 如何以编程方式在angular1中的ui传单地图上添加矩形,angularjs,leaflet,angular-material,ui-leaflet,Angularjs,Leaflet,Angular Material,Ui Leaflet,在HTML中,我的地图定义如下 <leaflet bounds="map.spatial_bounds_card" layers="map.layers_card" height="200px" ></leaflet> 在您的代码中,还有一些额外的参数。让它尽可能简单 比如: angular.extend($scope, { center: { lat: 54.559322, lng: -5.767822,
<leaflet bounds="map.spatial_bounds_card" layers="map.layers_card" height="200px" ></leaflet>
在您的代码中,还有一些额外的参数。让它尽可能简单 比如:
angular.extend($scope, {
center: {
lat: 54.559322,
lng: -5.767822,
zoom: 14
},
defaults: {
maxZoom: 25,
minZoom: 1,
path: {
weight: 10,
color: '#800000',
opacity: 1
}
}
});
var markersFeatureGroup = new L.FeatureGroup();
leafletData.getMap()
.then(function(map) {
var latlang = L.latLng(50.5, 30.5);
var circleobj = L.rectangle([[54.559322, -5.767822], [54.560900, -5.760000]],{
color: 'blue'
}).bindLabel("Hello World", { direction: 'bottom', clickable: "interactive" });//use left, left, auto,
markersFeatureGroup.addLayer(circleobj);
map.addLayer(markersFeatureGroup);
});
有关更多信息,请参阅JSFIDLE:没有任何帮助,因为我的问题是在ui传单的上下文中提出的,而不是角度传单指令。谢谢你,tho。好的,没问题。如果您仍然面临这个问题,请发送小提琴链接或代码给我,以便我可以检查它。
angular.js:13920 TypeError: t.addLayer is not a function
at e.addTo (leaflet.js:7)
at new FilterSpatialCardCtrl (filter_spatial_card.controller.js:50)
at Object.invoke (angular.js:4718)
at $controllerInit (angular.js:10354)
at nodeLinkFn (angular.js:9263)
at angular.js:9673
at processQueue (angular.js:16383)
at angular.js:16399
at Scope.$eval (angular.js:17682)
at Scope.$digest (angular.js:17495)
angular.extend($scope, {
center: {
lat: 54.559322,
lng: -5.767822,
zoom: 14
},
defaults: {
maxZoom: 25,
minZoom: 1,
path: {
weight: 10,
color: '#800000',
opacity: 1
}
}
});
var markersFeatureGroup = new L.FeatureGroup();
leafletData.getMap()
.then(function(map) {
var latlang = L.latLng(50.5, 30.5);
var circleobj = L.rectangle([[54.559322, -5.767822], [54.560900, -5.760000]],{
color: 'blue'
}).bindLabel("Hello World", { direction: 'bottom', clickable: "interactive" });//use left, left, auto,
markersFeatureGroup.addLayer(circleobj);
map.addLayer(markersFeatureGroup);
});