Here's a snippet of an angular google map:
<ui-gmap-markers models='theWinner' events="map.markerEvents" coords='"coordinates"'>
<ui-gmap-windows show="show">
<div ng-non-bindable>{{ coordinates }}</div>
<div ng-click="$root.derp(coordinates)">navigate</div>
</ui-gmap-windows>
</ui-gmap-markers>
I need derp()
to be in $root
in order to use it from within the angular google map. I also need to pass the coordinates
which are defined in regular ol' $scope
. As-is, the above code does not work. {{ coordinates }}
are available to the template, but not they are not passed to $root.derp()
.
What's the cleanest way to fix this problem? Thanks!
Edit: It occurs to me that I could explicitly create a copy of the coordinates
in a $root
variable, like so:
$scope.$root.coordinates = coordinates;
Kind of messy, having two copies of the same variable, but it works. Is there a better way? I don't like abusing $root more than I have to.