Skip to content

google-maps: expose directives for template reference usage #19462

@anthonyblanchettepotvin

Description

Feature Description

Add exportAs directive meta-data to the map-polygon, map-polyline, map-circle and map-rectangle directives. That would allow to template reference the directives' class's instance in order to pass it as an argument into a function call, to access its properties from within the DOM and everything else that template referencing features.

Use Case

You could create a template reference inside a map-polygon directive tag and pass the reference as an argument into a function call like so :

issue_1

This allows the function onPolygonClick to receive the MapPolygon instance, as an argument, of the polygon that has been clicked. With that you could change the properties of the MapPolygon instance like editable, draggable, visible to dynamically modify the appearance and the behavior of the polygon.

issue_2

Current Use Case

Correct me if I am wrong, but at the moment, I don't think this is possible. The MapPolygon directive doesn't have the exportAs meta-data, so it's not possible to template reference a MapPolygon instance.

Of course, you can pass the google.map.Polygon object declared in an *ngFor in a function call like so :

issue_3

But then, doing something like that :

issue_4

Do not hide the polygon.

Scope

This issue applies to the following directives : map-polygon, map-polyline, map-circle and map-rectangle.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: google-mapsfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions