Angular google maps hide show marker

Angular google maps question http://angular-ui.github.io/angular-google-maps/#!/

Is it possible to hide and show individual markers that has been added to ui-gmap-markers?

I found the solution.

In html I added options="‘markerOptions’"

        <ui-gmap-markers models='markers' coords="'coords'" options="'markerOptions'" idkey="marker.id">
                <ui-gmap-windows show="show">
                    <div ng-non-bindable>{{title}}</div>
                </ui-gmap-windows>
            </ui-gmap-markers>

In javascript I added markerOptions:

                 var marker_visible = false;

                 if (condition)
                     marker_visible = true;

                 $scope.markers.push({
                     id: val.id,
                     coords: {
                         latitude: val.lat,
                         longitude: val.lng
                     },
                     title: infowindow,
                     dizi_id: val.dizi_id,
                     markerOptions: { visible: marker_visible }
                 });
1 Like