Open ezk84 opened 6 years ago
Hi @ezk84!
Events was the first things that I did in the directive. Thank you for the advice! I will update a new version with that enhancement.
Thank you!
The only problem may be with the mouse events, where each mouse move would trigger a digest cycle through $rootScope.apply
, may be too much no?
Also i need to control and get access to data in controllers. can it be done with about mapInstance
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](https://github.com/angular/angular.js/wiki/Dev-Guide%3A-When-to-use-%24scope.%24apply()), $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:' ...))
insidemapboxglEventsUtils.exposeMapEvents
or inglControl
when adding angular events for the control?This is relevant particularly when listening to mapboxglDraw events.