-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Windows directive model can not be altered #571
Comments
Plunkr please. |
I'm not sure if this is exactly his issue but it sounds like the root problem is the same. http://plnkr.co/edit/r1m3cawqCJ62jljsnZ9R?p=preview If you add the markers one at a time, only the first markers window will show. If you add them all at once, it works fine. Which is strange b/c the only difference in those two functions is me clicking the button. The function that adds them all at once pushes a new marker and then "updates" the model and then moves on to the second marker. Just as if I was pressing the button rapidly. One works, the other doesn't. Note, remember to refresh before attemping to use the other button. |
So I was playing around with this some more and I noticed that if you remove the contents of the map.markers before adding new ones, it works fine. http://plnkr.co/edit/e9tkI5PNCJLNGl4WAJ85?p=preview Use the "add 1 at a time" button but click "remove markers" before attempting to add another marker (whether 1 at a time or all at once) This is crappily written so if you do any of the other two buttons, add all at once or add new set, you have to refresh to use the 1 at a time button properly. But the key is to always "remove markers" before attemping to add more markers. This seems to update everything correctly on the map. I don't know if this is the intended behavior or if this is b/c of angular or the directive but, it works. So, whatever. |
BTW there is no reason to be using windows, unless you really need them all in memory at once. It is way more efficient to track an active markers array in your controller and use normal window to open and close only what you need. Best use case for windows is if you need them as a markers replacement. |
Oh really? I was just following the examples from the project. It seemed to always be if you have markers, then you used windows. I think I tried using just a window once but it wouldn't show so I assumed that was why the example had windows with markers. I'll have to try that monday when I get back to work. I found A solution so I'm happy for now. If you can confirm this is an error in angular or the directive or just intended behavior, I would appreciate it. I can update the plunkr to be a bit more friendly. I just noticed something that made me think I had a solution finally so I hastily coded it :D |
To find a quasi implementation details search this repo for 'epiphany'. |
@chanpod sorry about the comment earlier, I was reading it on my phone. I initially interpreted crapily w/ reference to the windows directive. |
@nmccready hehe, no problem. Would be silly to insult the guy I'm asking help from XD But I guess you can't be too surprised by people these days. |
ohhhh!! Thank you. Yeah I was having the same issue. I was looking at the example and saw windows inside the markers so I thought that was the right way. I'll try using window now. 👍 |
BTW I don't want to spam or anything, but @nmccready is correct. I was having issues with windows and now after setting up window it works perfectly. Thank you for solving my problem. |
I played a bit more with this. The issue being exhibited appears to be an angular thing. If instead of assigning to an empty array, the existing array is cleared, everything works as expected. Demonstrated here http://plnkr.co/edit/omnUA8u4as11llGR1CnA?p=preview , This makes me think that a reference is being held onto somewhere, but I haven't dug that far into it. As to this bug, I think I'm going to close it. |
Hi. I have a 'windows' directive with a model that is an empty array at first. Instead of filling it first and then switching the "show" attribute state I decided to add and remove items to the models array. If I populate the model right away, everything works fine and if I add or remove items later (with show = true) the changes don't occur on the map. Is this the expected behavior?
The text was updated successfully, but these errors were encountered: