gpt4 book ai didi

javascript - Angular 标记信息窗口

转载 作者:行者123 更新时间:2023-12-03 11:16:47 25 4
gpt4 key购买 nike

找不到关于 <ui-gmap-markers> 的任何文档,只是想变得非常基本

content = "<div><h3>Title</h3>Text here..</div>"使用大量标记时点击添加。所有文档均适用于单一标记。

$scope.change_type = function(val) {
content = "<div><h3>Title</h3>Text here..</div>"
$scope.markers = [] //clears the map
$scope.markers = Events.venues(val.type)
}

标记数据类似于

{options:{ title:"Barney's"},type:'Bar', latitude: 42.992538, longitude: -81.251819}

我在index.html中有以下内容

<script src='lib/lodash/dist/lodash.js'></script>
<script src='lib/angular-google-maps/dist/angular-google-maps.js'></script>
<script src='lib/addons/markerwithlabel.js'></script>

最佳答案

我希望这可以帮助你 - 我今天刚刚弄清楚如何使用ui-gmap-markers,所以请原谅任何粗糙的边缘..我的 HTML,运行正常:

<ui-gmap-google-map center='main.map.center' zoom='main.map.zoom' options='main.map.options'>
<ui-gmap-markers models="main.markers" coords="'self'" icon="'icon'" options="'options'" click="'onClick'" fit="true">
<ui-gmap-windows show="'showWindow'" closeClick="'closeClick'" ng-cloak>
<div data-ui-sref="display">
<span data-ng-non-bindable>{{ title }}</span>
</div>
</ui-gmap-windows>
</ui-gmap-markers>
</ui-gmap-google-map>

在我的 Controller 中,我这样做:

uiGmapGoogleMapApi.then(function(maps) {
var markers = [];
_.each(vm.itemlist,function(item){
search.getGeometry(item.href).then(function(marker) { // I look up gps coord elsewhere
marker.id = item.href;
marker.showWindow = false;
marker.options = {
title: item.name,
icon: markericon.normal
};
marker.onClick = function() { vm.markerClick(marker); };
marker.closeClick = function() { vm.markerCloseClick(marker); };
markers.push(marker);
});
});
vm.markers = markers;
});

希望你能从中得到一些提示..

关于javascript - Angular 标记信息窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27308462/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com