如何将ui-gmap-marker重写为ui-gmap-markers?

时间:2015-11-19 11:22:17

标签: angularjs google-maps-markers angular-google-maps

我是角色和uiGmapGoogleMapApi的新手,我正在尝试重写这个:

<ui-gmap-google-map center="search.map.center" zoom="search.map.zoom" bounds="search.map.bounds" options="{ overviewMapControl: true, streetViewControl: false, mapTypeControl: false }">
    <locations ng-if="! search.isLoading" ng-repeat="player in search.results track by $index">
        <ui-gmap-marker ng-repeat="item in player.l track by $index" ng-if="item.g" idKey="$index" coords="{ latitude: item.g[0], longitude: item.g[1] }" options="{ labelContent: item.n }">
            <ui-gmap-window>
                <div>
                    <a ng-href="{[{ search.getplayerUrl(player) }]}">{[{ player.n }]}</a>
                    <p>{[{ player.s }]}</p>
                </div>
            </ui-gmap-window>
        </ui-gmap-marker>
    </locations>
</ui-gmap-google-map>

到ui-gmap-markers。 因为带有ng-repeat的ui-gmap-marker的性能非常糟糕。 从这一点来说,我没有取得成功。我没有得到任何错误。

<ui-gmap-google-map center="search.map.center" zoom="search.map.zoom" bounds="search.map.bounds" options="{ overviewMapControl: true, streetViewControl: false, mapTypeControl: false }">
    <locations ng-if="! search.isLoading" ng-repeat="player in search.results track by $index">
        <ui-gmap-markers models="player.l" idKey="id" coords="{ latitude: g[0], longitude: g[1] }" options="{ labelContent: n }" />
        <ui-gmap-window>
            <div>
                <a ng-href="{[{ search.getplayerUrl(player) }]}">{[{ player.n }]}</a>
                <p>{[{ player.s }]}</p>
            </div>
        </ui-gmap-window>
    </locations>
</ui-gmap-google-map>

有谁知道我做错了什么?

1 个答案:

答案 0 :(得分:0)

coords属性必须是字符串。

The document说:

  

coords:string
  包含标记的models数组中的属性名称   坐标。必须引用包含纬度和经度的对象   属性或GeoJSON Point对象。