UI的GMAP-标记不工作 [英] ui-gmap-markers is not working

查看:158
本文介绍了UI的GMAP-标记不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试把一些标志在地图中使用角谷歌,地图图书馆,我可以得出的有一个使用标记 UI-GMAP标志物而不是许多使用标记 UI-GMAP-标记。这是我的 JS code。

im trying to put some markers in a map using the angular-google-maps library, i can draw one marker using ui-gmap-marker but not many markers using ui-gmap-markers. Here is my js code.

angular.module('myApp').controller('homeController', [homeController]);

function homeController(){
    var vm = this;

    vm.map = {
        center:{
            latitude: 46.8032826,
            longitude: -71.242796
        },
        zoom: 12
    };

    vm.places = [
                 {
                   idKey: 583187,
                   latitude: 46.7682,
                   longitude: -71.3234,
                   title: "title"
                 }
               ];
};

HTML

<ion-view ng-controller="homeController as vm">
<ui-gmap-google-map draggable="true" center="vm.map.center" zoom="vm.map.zoom">
    <ui-gmap-markers models="vm.places" coords="'self'" icon="'icon'"></ui-gmap-markers>
</ui-gmap-google-map>
</ion-view>

我可以看地图,用的console.log 我可以看到地方阵列的设置是否正确,但我看到没有在所有的标记!有什么不对我的code?

I can see the map, with a console.log i can see that the places array is correctly set, but i see no markers at all ! what is wrong with my code ?

感谢您。

PS:使用即时消息通知离子,即时通讯河畔它无关的问题。

PS: notice im using ionic, im sur it has nothing to do with the problem.

推荐答案

要么改变你的idKey为ID,或指定&LT; UI-GMAP标记物模型=vm.placesCOORDS ='自我'图标='图标idKey ='idKey'&GT;&LT; / UI-GMAP-标记&GT;

Either change your idKey to id, or specify <ui-gmap-markers models="vm.places" coords="'self'" icon="'icon'" idKey="'idKey'"></ui-gmap-markers>

这篇关于UI的GMAP-标记不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆