0
所以我创建标记,当这样一个新文档插入FSCollection上。创建标记与FSCollection
我有这个发现变量。
cordenadasClientes = Clientes.find({}, {fields:{'metadata.latCliente': 1,'metadata.longCliente':
遵循这个eachFunction。
var count = 0,
markers = [],
marker;
cordenadasClientes.forEach(function(){
var latitudCliente = cordenadasClientes[count].metadata.latCliente;
var longitudCliente = cordenadasClientes[count].metadata.longCliente;
var nombreCliente = cordenadasClientes[count].metadata.nombreCliente;
marker = new google.maps.Marker({
position: new google.maps.LatLng(latitudCliente ,longitudCliente),
map: map,
title: nombreCliente,
icon :'http://maps.google.com/mapfiles/marker_yellow.png',
})
count++;
markers.push(marker);
})
及其工作相当发现,每次我上Clientes创建一些文件收集时间,插入的标记的,所以也有这个标记阵列,所以每次一个新标志其创建标记。推(标记);它的执行,并且那woork不错的,但我现在想这样做
google.maps.event.addListener(markers, 'click', function() {
map.setZoom(8);
});
但不工作,所以即时通讯设法看看我的标记数组看起来像这样使其他功能;
function arrayMarkers(element,index,array){
console.log(markers);
}
并调用arrayMarkers功能这样;
[markers].forEach(arrayMarkers);
并获取此Console.log;
im the index : 0 and the object [object Object],[object Object]
所以我想创建标记sotring一个阵列上,并使用一个事件监听标志,什么即时做错了?好像很喜欢后事件侦听器只是1个标记
例如 工作我有2个标记,所以当我点击1标记时它的缩放非常完美,但是当我点击第二个标记时它的标记为第一个标记
这是我的标记数组的外观; [开,开]> 0: 1:
一样,如果数组
和如果我使用
function arrayMarkers(element,index,array){
console.log(array);
}
我得到这个
[Array[2]]
>
0: Array[2]
>
0: On
1: On
上IM嵌套阵列