如何在使用angular-google-maps指令时删除谷歌地图标记

时间:2014-11-11 21:26:01

标签: angularjs angular-google-maps

因此,在使用angular-google-maps时,我在删除网页上的标记时遇到问题。 这是haml:

    %div.map-view
      %ui-gmap-google-map{control:"controller.map.control", center: "controller.map.center", zoom: "controller.map.zoom", options: "controller.mapOptions"}
        %ui-gmap-markers{control:"controller.markers", models: "controller.points", idkey: "'location_id'", coords: "'self'", icon: "'icon'", fit: "true", click: "'onClicked'"}

然后在我的控制器中:

deleteMarkers: () =>
  if(@markers.getGMarkers().length != [].length)
    @markers.removeMany(@markers.getGMarkers())

最后一行不起作用,因为removeMany方法似乎没有在控件上公开,我收到此错误:

  

TypeError:undefined不是函数

感谢任何帮助!

0 个答案:

没有答案