angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

Marker Labels

Open MauritzKruger opened this issue 12 years ago • 4 comments

Hi Nicolas

Would like to know if it is possible to add into the directive the ability to only show labels when a certain zoom level has been reached. I tried using a class, but the marker style is breaking this functionality. Would appreciate any feedback/help in this matter...

MauritzKruger avatar Apr 17 '14 12:04 MauritzKruger

Can you use an ng-if on the marker directive so that it only appears when the map's zoom level reaches your desired threshold level?

rickhuizinga avatar Apr 17 '14 20:04 rickhuizinga

Good day Rick

Tried using the ng-if as suggested, but for some reason the all my markers stayed on the map even it I filtered them - going from 233 markers down to 2, my code looked like this after editing: <google-map center="mapObjects.center" zoom="mapObjects.zoom" draggable="true" options="mapObjects.options" control="mapObjects.control"> <markers ng-if="mapObjects.zoom < 12" models="mapObjects.markers" coords="'self'" icon="'icon'" click="'onClicked'" fit="true"></markers> <markers ng-if="mapObjects.zoom > 11" models="mapObjects.markers" coords="'self'" icon="'icon'" click="'onClicked'" labelContent="'title'" labelAnchor="22 0" labelClass="marker-labels" fit="true"></markers> <window coords="window.coordinates" show="window.show" options="window.options" templateUrl="window.templateUrl" templateParameter="window.templateParameter"></window> </google-map>

MauritzKruger avatar Apr 22 '14 10:04 MauritzKruger

On markers, ng-if would cause the entire element to not be included in the document. I was thinking you were using marker.

For markers, use the model's option field to conditionally set the the visible field conditionally based on the zoom. See the options field documentation: https://developers.google.com/maps/documentation/javascript/reference#MarkerOptions

rickhuizinga avatar Apr 22 '14 16:04 rickhuizinga

Can this be closed?

rickhuizinga avatar Jul 16 '14 22:07 rickhuizinga