Closed digitalgym closed 10 years ago
Because you have a direct hook to the google map sdk right there. That event is not angular at all. Therefore it has no dirty checking around it. Therefore apply is required.
Added an entry in the FAQ
IMO, it doesn't make a lot of sense here to require the $scope.apply to be called, it should be wrapped by the directive.
Leaving this to the developer leaves more room for customization on how and when $apply is called. Wrapping this in the directive removes this freedom. Again, see $apply docs
I totally agree with @nlaplante , there are times where you do not want to use $apply for performance reasons. Plus there is no way for our directive to know when the event has been passed to you. You have a direct hook to the google maps API on the events property.
Examples would be silent changes or making more json requests based off the event. In that example you would not be needing apply at all (until after the JSON callback is done).
Ok, it just sux to have this duplicated in every one of my events. :/
2014-03-18 14:30 GMT+01:00 nmccready notifications@github.com:
Examples would be silent changes or making more json requests based off the event. In that example you would not be needing apply at all (until after the JSON callback is done).
Reply to this email directly or view it on GitHubhttps://github.com/nlaplante/angular-google-maps/issues/241#issuecomment-37932049 .
[image: INSA de Lyon] Jean-Marie Comets Élève Ingénieur - INSA de Lyon jean.marie.comets@insa-lyon.fr jean.marie.comets@insa-lyon.fr tél: +33(0)699659407
Yeah a work around would be to implement something like ui-leaflet using rootScope or scope to pass events around via $on
but that modification will require a major PR from someone else.
I'm noticing that events assigned to the events:{} bag require the apply() call. Why are events being called in a non-angular fashion like this.