S
S
Seva2015-09-01 17:54:27
Angular
Seva, 2015-09-01 17:54:27

How do I change the visibility of a Google Maps marker?

Good afternoon! I display a map with markers using the directive .

<map center="50.4501, 30.5234" zoom="11" style="height: 100%" data-tap-disabled="true">
    <marker ng-repeat="item in items | limitTo: 50" icon="img/marker.png" position="{{item.coords}}" eventid={{item.id}} on-click="go()">
    </marker>
</map>

We need to dynamically change the visibility of the markers depending on the function that returns true or false . I tried to add ng-if, ng-show to the marker, I tried to hang a function on the marker's visible property - nothing works.
Any ideas? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2015-09-02
@healqq

Try using custom-marker, it should be fine. Another option is to add the setVisible method to the marker directive . when setting attributes, a check is made for the presence of a setter method (see mapController observeAndSet method). For example, copy it from the custom-marker directive.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question