0

I am using

<ui-gmap-windows>

element in Angular, and I need to show the content of dynamic array inside the marker. I tried using ng-repeat, but it did not work. Basically, I need that when the user clicks on a marker, the info window should show the list of items associated with that marker.

1
  • Its hard to suggest anything by just <ui-gmap-windows>, please show your controller.js especially how you set up the markers. Commented Sep 3, 2015 at 21:57

1 Answer 1

1

You should associate the list with the marker itself.

so when you create your marker in Angular try this

var markers = [];

for(var i = 0; i < latLng.length; i++){
    markers.push({
        id: i,
        ...
        ...
        myList:[{...},{...}]
    });
}

Your html should look something like this:

<ui-gmap-google-map...
   <ui-gmap-marker ng-repeat="m in markers"...
      <ui-gmap-window...

         [Your Info Window Content Here]

         <div>{{m.myList[0].stuff}}</div>
         <div>{{m.myList[1].stuff}}</div>
         <div>{{m.myList[2].stuff}}</div>

      </ui-gmap-window>
   </ui-gmap-marker>
</ui-gmap-google-map>

As you can see, you can pull data from the parent marker collection (m, defined in ui-gmap-marker) and use it in any of its children.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.