4

I'm relatively new to angular.

I'm using angular-google-maps and can't figure out how to get a tooltip/infowindow to display when hovering over a marker: basically what you get when you use the straight google maps api and set the 'title' attribute of the marker object (as in https://developers.google.com/maps/documentation/javascript/examples/marker-simple)

I've tried the markers element with the labelContnent attribute, and the marker with the marker-label element - neither shows a tooltip with the marker title.

The angular-google-maps demo (http://angular-google-maps.org/demo) also doesn't show any tooltips, so I don't think I'm doing anything wrong.

The question is, how do I get the title to display?

TIA!

4

1 回答 1

4

您需要在创建标记时提供一个options包含 的成员。title

抱歉,我没有一个小的工作示例,但您希望您的标记对象看起来像这样:

var marker = {
    coords: { latitude: 38.8977, longitude: -77.0366 },
    icon: 'images/whitehouse.png',
    options: { title: 'The White House' }
    id: 12345
};

然后在<marker>or<markers>指令中指定所有这些属性名称。

然后,当鼠标悬停在图标上时,应该会出现一个工具提示。请注意,浏览器显示图标的速度可能非常慢,因此请先将鼠标悬停在图标上几秒钟,然后再确定它不起作用。

如果要显示信息窗口而不是工具提示,则需要处理mouseovermouseout事件。该文档目前(2014 年 6 月)对如何执行此操作非常模糊,并且仅<marker>支持<markers>.

于 2014-06-17T02:19:15.427 回答