Skip to content
This repository was archived by the owner on Jun 10, 2023. It is now read-only.
This repository was archived by the owner on Jun 10, 2023. It is now read-only.

Map events are not $broadcast inside an $apply #48

@ezk84

Description

@ezk84

Currently, if I hook into map events using $scope.$on('mapboxglMap:...' the handler is running outside of a digest cycle and so model changes inside of them will not be reflected through the rest of the app.

According to the Angular dev guide, $scope.$apply() should occur as close to the async event binding as possible.

Is there a reason not to do $rootScope.$apply($rootScope.$broadcast('mapboxglMap:' ...)) inside mapboxglEventsUtils.exposeMapEvents or in glControl when adding angular events for the control?

This is relevant particularly when listening to mapboxglDraw events.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions