0

I work with angularjs-google-maps and I used this example for my application. In the controller at vm.shops if I change the:

vm.shops = [
    {id:'1', name: 'FOO SHOP', position:[41,-87]},
    {id:'2', name: 'BAR SHOP', position:[42,-86]}
];

To:

vm.shops = [
    {id:1, name: 'FOO SHOP', position:[41,-87]},
    {id:2, name: 'BAR SHOP', position:[42,-86]}
];

So the id number is without '' the info Window appears for all markers in the same position and this position is not above each marker.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Antonis
  • 195
  • 1
  • 3
  • 13

2 Answers2

1

showInfoWindow is expecting a string, so you can use toString() on shop.id:

  vm.showDetail = function(e, shop) {
    vm.shop = shop;
    vm.map.showInfoWindow('foo-iw', shop.id.toString());
  };

Updated Demo

Michael Doye
  • 8,063
  • 5
  • 40
  • 56
1

You can parse to string your shop IDs in the showDetail function:

vm.map.showInfoWindow('foo-iw', shop.id + '');

Forked Plunker

Community
  • 1
  • 1
Mistalis
  • 17,793
  • 13
  • 73
  • 97