angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

templateParameter not updating

Open dgavigan opened this issue 12 years ago • 4 comments

I am using build angular-google-maps 1.0.17 2014-03-30 and have various markers displayed on the map in the following way:

<markers models='components' coords="'self'" doCluster='true' click="'getDetails'"> </markers>

Im then using the window component to show details for the selected marker:

<window coords="windowCoords" show="displayWindow" templateUrl="'views/info-window.html'" templateParameter="componentDetails"> </window>

getDetails() is triggered when a marker is selected, returning the correct data for the selected marker.

However, once I set $scope.componentDetails = newData I'm still getting the old window details, and the info window is not rendering with the updated data. It does appear to be picking up the new coords as the window displays in the correct location, but with stale data.

Anyone ever run into something similar or am I implementing this wrong?

dgavigan avatar Apr 02 '14 21:04 dgavigan

If I get time this week, I'll look into it. Otherwise it will have to wait till Sat, or Sunday.

nmccready avatar Apr 03 '14 02:04 nmccready

I was able to solve this simply by setting show to false first in my getDetails(). Whereas before I was setting it to true every time.

Because show was true every time on getDetails(), the watch function that is listening for the change in show would not be detected .

dgavigan avatar Apr 03 '14 12:04 dgavigan

:+1:

nmccready avatar Apr 04 '14 00:04 nmccready

This was helpful to read about, as I was having the same issue. For others coming to this issue in the future, consider modifying any property that's tied to the ui-gmap-window's options parameter, and that'll get the templateParameter changes to also be appreciated.

In my case, I set a new placeholder property windowOptions.modelId = <the_new_model's_id> upon every click, just for the sake of triggering the watcher.

jessemorton avatar Feb 19 '16 22:02 jessemorton