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

[2.0.12] Dynamically MARKERS updating marker icon image not working

Open andrjones opened this issue 11 years ago • 19 comments

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

andrjones avatar Jan 13 '15 13:01 andrjones

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

nmccready avatar Jan 16 '15 17:01 nmccready

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 avatar Jan 16 '15 18:01 zlegein

@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.

nmccready avatar Jan 16 '15 18:01 nmccready

@zlegein also try the 'modelsby' ref.

nmccready avatar Jan 16 '15 18:01 nmccready

@zlegein try latest w/ regards to plurals [develop]

nmccready avatar Jan 16 '15 19:01 nmccready

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.

andrjones avatar Jan 16 '15 19:01 andrjones

Back on 2.0.12 and modelsbyref doesn't appear to have helped (when setting the icon property)

andrjones avatar Jan 16 '15 19:01 andrjones

plunkr updated with develop http://plnkr.co/edit/UdYgyJVGuMFthauqJMED?p=preview

andrjones avatar Jan 16 '15 20:01 andrjones

I added a patch for the latest error: https://github.com/angular-ui/angular-google-maps/pull/1094

zlegein avatar Jan 16 '15 20:01 zlegein

@andrjones here is an update to your plunker with the patch that toggles: http://plnkr.co/edit/z9uo2OsshQ7gZ4b7g0gX?p=preview

zlegein avatar Jan 16 '15 21:01 zlegein

@nmccready sorry for not attaching that PR to the right issue, my bad

zlegein avatar Jan 16 '15 21:01 zlegein

@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 avatar Jan 16 '15 21:01 andrjones

@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.

zlegein avatar Jan 16 '15 21:01 zlegein

Ahh, sorry about that, my bad, I didn't realize the pull request was still outstanding.

andrjones avatar Jan 16 '15 21:01 andrjones

The plural stuff should be resolved. I am using it specifically at work across marker and polygons.

nmccready avatar Jan 16 '15 22:01 nmccready

@zlegein nice example I will add this to /examples and debug with it. Thank you.

nmccready avatar Jan 16 '15 22:01 nmccready

Should be fixed.

nmccready avatar Jan 20 '15 15:01 nmccready

Updated plnkr. http://plnkr.co/edit/hDh9yhpyWuvsuEvhdUpT

nmccready avatar Jan 20 '15 15:01 nmccready

Works great! Thanks for the fix team :)

andrjones avatar Jan 21 '15 02:01 andrjones