[2.0.12] Dynamically MARKERS updating marker icon image not working
Regardless of whether I replace a marker object with a new object containing a different icon, or whether I directly update the icon property of a given marker, the marker icon does not change. See http://plnkr.co/edit/q2xTbpWvrBcHsPMDIeuk?p=preview
It would help to specify version and or branch of issue. Lastly specify the directive (which i think is markers). The plnkr link is currently not working. If it is markers then try setting modelsbyref to false or 'false' . This turns on deep watching.
This attribute is currently not documented and is slated to be be #1086
The latest snapshot of the develop branch works for changing the icon property, but doesn't work when trying to update the marker object. Here is an update to the plunker that allows for a property change. http://plnkr.co/edit/IqVxSg6tKnOIWAq7zhmj?p=preview
Now this is where things got tricky as this is my first pass through this code. In order to get the marker object to change, it appears you will need use the control attribute on the marker directive and set a markerControl object to bind to. http://angular-ui.github.io/angular-google-maps/#!/api
You then have two functions to get access to the individual markers getGMarkers() and getChildMarkers(). The latter did not work and parentModel.plurals is undefined, which makes sense because it is not available on MarkersParentModel. If I add @plurals = @scope.plurals on MarkersParentModel (https://github.com/angular-ui/angular-google-maps/blob/develop/src/coffee/directives/api/models/parent/markers-parent-model.coffee) it then can get the child makers. Plunker is down right now will put together another one to show that change.
The problem with changing the underlying maker object is that changing the properties doesn't work anymore. I imagine this is a binding issue where replacing the object you then lose binding
@zlegein good info. I am about to make sure plurals works locally (i should have put specs in). Nice catch another inconsistency I missed. I'll fix this.
@zlegein also try the 'modelsby' ref.
@zlegein try latest w/ regards to plurals [develop]
I just grabbed the latest develop and updating the icon property does not seem to be working. On 2.0.12 the icon would disappear, it's no longer doing that, but it also isn't updating to the new icon. I see from the plunkr that is was working on develop yesterday. I'll play around more to see if I'm still missing something.
Back on 2.0.12 and modelsbyref doesn't appear to have helped (when setting the icon property)
plunkr updated with develop http://plnkr.co/edit/UdYgyJVGuMFthauqJMED?p=preview
I added a patch for the latest error: https://github.com/angular-ui/angular-google-maps/pull/1094
@andrjones here is an update to your plunker with the patch that toggles: http://plnkr.co/edit/z9uo2OsshQ7gZ4b7g0gX?p=preview
@nmccready sorry for not attaching that PR to the right issue, my bad
@zlegein thanks for the updated plunkr. I have grabbed the latest develop and it still isn't working for me. I have no idea why, all I'm doing is updating the icon property to a new icon (as you are in the plunkr) but it isn't working for me. I'm probably doing something stupid so I'll keep playing around. On a related note, i notice in your plunkr that once you use the button to replace the marker object, clicking the button to simply update the icon property no longer works. The reverse does not appear to be true (you can update the icon property, and then update the marker object) (not that you would ever write an app that uses both methods anyway...).
@andrjones dont grab the latest yet, the plunker has the PR i created to fix the error you were getting. @nmccready seems to be active on this, once he applies the patch the latest will have the fix.
Ahh, sorry about that, my bad, I didn't realize the pull request was still outstanding.
The plural stuff should be resolved. I am using it specifically at work across marker and polygons.
@zlegein nice example I will add this to /examples and debug with it. Thank you.
Should be fixed.
Updated plnkr. http://plnkr.co/edit/hDh9yhpyWuvsuEvhdUpT
Works great! Thanks for the fix team :)