angularjs-google-地图信息window位置
angularjs-google-maps Info window position
我使用 angularjs-google-maps 并在我的应用程序中使用了 this 示例。在 vm.shops
的控制器中,如果我更改:
vm.shops = [
{id:'1', name: 'FOO SHOP', position:[41,-87]},
{id:'2', name: 'BAR SHOP', position:[42,-86]}
];
收件人:
vm.shops = [
{id:1, name: 'FOO SHOP', position:[41,-87]},
{id:2, name: 'BAR SHOP', position:[42,-86]}
];
因此 ID 号没有 ''
信息 Window 出现在同一位置的所有标记,并且该位置不在每个标记上方。
showInfoWindow
需要一个字符串,因此您可以在 shop.id
:
上使用 toString()
vm.showDetail = function(e, shop) {
vm.shop = shop;
vm.map.showInfoWindow('foo-iw', shop.id.toString());
};
您可以在 showDetail
函数中 parse to string 您的商店 ID:
vm.map.showInfoWindow('foo-iw', shop.id + '');
Forked Plunker
我使用 angularjs-google-maps 并在我的应用程序中使用了 this 示例。在 vm.shops
的控制器中,如果我更改:
vm.shops = [
{id:'1', name: 'FOO SHOP', position:[41,-87]},
{id:'2', name: 'BAR SHOP', position:[42,-86]}
];
收件人:
vm.shops = [
{id:1, name: 'FOO SHOP', position:[41,-87]},
{id:2, name: 'BAR SHOP', position:[42,-86]}
];
因此 ID 号没有 ''
信息 Window 出现在同一位置的所有标记,并且该位置不在每个标记上方。
showInfoWindow
需要一个字符串,因此您可以在 shop.id
:
toString()
vm.showDetail = function(e, shop) {
vm.shop = shop;
vm.map.showInfoWindow('foo-iw', shop.id.toString());
};
您可以在 showDetail
函数中 parse to string 您的商店 ID:
vm.map.showInfoWindow('foo-iw', shop.id + '');