Class: scaleselectorDirective directive:ngeoScaleselector

ngeo.scaleselectorDirective

new scaleselectorDirective(ngeoScaleselectorTemplateUrl)

Provides the "ngeoScaleselector" directive, a widget for selecting map scales.

Example:

<div ngeo-scaleselector="ctrl.scales" ngeo-scaleselector-map="ctrl.map">
</div>

The expression passed to the ngeo-scaleselector attribute should return an object of this form:

[20000, 10000, 5000, 2500]

This object's keys are strings representing zoom levels, the values are strings representing scales. The directive's partial uses ng-bind-html so the scale strings should be trusted.

That directive's partial uses Bootstrap's dropdown and dropdown-menu classes, and data-toggle="dropdown", so it is meant to be used with Bootstrap's "dropdown" jQuery plugin.

By default the directive uses "scaleselector.html" as its templateUrl. This an be changed by redefining the "ngeoScaleselectorTemplateUrl" value.

The directive has its own scope, but it is not isolate scope. That scope includes a reference to the directive's controller: the "scaleselectorCtrl" scope property.

The directive doesn't create any watcher. In particular the object including the scales information is now watched.

See our live example: ../examples/scaleselector.html

HTML attributes:
Name Type Description
ngeo-scaleselector-scales The available scales (key: scale, value: display text).
ngeo-scaleselector-map The map.
Returns:
angular.Directive

Directive Definition Object.