【问题标题】:What to write in expression in click='{expression}'?在 click='{expression}' 的表达式中写什么?
【发布时间】:2014-07-23 15:20:26
【问题描述】:

我已将标记添加到谷歌地图,现在我想在单击标记时显示位置名称。我已经阅读了 API 文档,但我不确定在 click 和其他属性的表达式中应该写什么。

帮我解决这个表达部分。 我在 angularjs 中使用了所有这些。

我的代码是

<marker coords='{"latitude":place.location.latitude, "longitude": place.location.longitude}'
            click='{expression}'
            ></marker>

【问题讨论】:

  • 只需click='alert("your title")' ??
  • 它不工作...我仍然无法点击标记..

标签: angularjs google-maps google-maps-api-3 google-maps-markers


【解决方案1】:

在控制器中定义一些函数(或指令链接函数),比如

$scope.print = function(location){
    console.log(location);
}

那么就ng-click="print(place.location)"

【讨论】:

    猜你喜欢
    • 2020-07-08
    • 2021-12-30
    • 2012-01-07
    • 2015-10-01
    • 2014-08-10
    • 2019-11-26
    • 1970-01-01
    • 1970-01-01
    • 2022-11-17
    相关资源
    最近更新 更多