谷歌地图问题与clearAll

时间:2014-02-06 20:56:54

标签: javascript google-maps knockout.js

我正在尝试编写一个淘汰赛绑定处理程序(当我说写时,我的意思是根据我的目的调整其他人)以帮助我使用谷歌地图。

这是我的小提琴: http://jsfiddle.net/NJ2R5/15/

我已经达到了可以动态地向地图添加新标记的程度,但由于某种原因,我无法将clearAll函数绑定到我的地图对象。

operations = valueAccessor().operations;
            operations.clearAll.subscribe(function () {
                console.log('CLearing All Markers');
            });

如果有人可以看一看让我知道我哪里出错了,我将不胜感激。

非常感谢

1 个答案:

答案 0 :(得分:0)

看来我的问题是我自己的代码,它应该是:

operations = valueAccessor().operations;
            operations.clearAll = function () {
                debugger;
                var bounds = map.getBounds();

            };