Why is ng-non-bindable required for <ui-gmap-windows> element in Angular Google Maps? Why is ng-non-bindable required for <ui-gmap-windows> element in Angular Google Maps? angularjs angularjs

Why is ng-non-bindable required for <ui-gmap-windows> element in Angular Google Maps?


Basically this boils down to ui-gmap doing manual compilation of the template.

In standard angular if you have something like:

<directive>   <some-html>{{someBinding}}</some-html><directive>

That usually means that "directive" is transcluding the content, and therefore "someBinding" is bound to the scope in which "directive" instantiated, not the "directive" innerScope.

However, in the case of ui-gmap:

<ui-gmap-windows>   <some-html>{{someBinding}}</some-html></ui-gmap-windows>

The scope should be to each window that is created, not the scope of ui-gmap-windows instantiation. So if you don't have ng-non-bindable then the scope will be to the ui-gmap-windows instantiation and someBinding will not exist.

Essentially ui-gmap is using the transcluded element as a template for applying to each instantiated window object, but if angular gets in there and binds that element to the wrong scope, then ui-gmap can't rebind to the correct scope.

Hope that clarifies for you a bit.

On a separate note, you really shouldn't use ui-gmap-windows unless you need a number of windows displayed simultaneously. Use a single ui-gmap-window and tie to the active marker.