Skip to content
This repository was archived by the owner on Nov 30, 2018. It is now read-only.

[master] infoWindow does not update content based on $scope variables #354

Closed
franklindner opened this issue Apr 11, 2014 · 34 comments
Closed
Assignees
Labels
Milestone

Comments

@franklindner
Copy link

I want to show the distance and duration between two markers in an infoWindow. Those variables are getting updated every 10 seconds as a result of a request and changing marker positions. I can print out $scope.distance.duration it is getting updated nicely but the infoWindow never shows them.

HTML:

Distance: {{ distanceMatrix.distance.text }} | Duration: {{ distanceMatrix.duration.text }}


Could this be an issue or am I just doing it wrong?

@nmccready
Copy link
Contributor

What branch and a jsbjn or fiddle w the similar issue would help.

@nmccready
Copy link
Contributor

Master branch correct?

@franklindner
Copy link
Author

Correct, I was using the master branch. I had not found time to prepare the jfiddle till today sorry.

@giacomorebonato
Copy link

Is there a branch where this problem is solved?

@nmccready
Copy link
Contributor

Have you guys tried replacing references besides just updating the data on the same reference? Also is there a jsbin with this issue already?

@nmccready nmccready changed the title infoWindow does not update content based on $scope variables [master] infoWindow does not update content based on $scope variables Apr 18, 2014
@nmccready nmccready added this to the 1.1.0 milestone Apr 18, 2014
@nmccready nmccready self-assigned this Apr 18, 2014
@ghost
Copy link

ghost commented Apr 30, 2014

I came across the same issue and created a plunker to show the exact problem

http://plnkr.co/edit/tHU3OK8SW1M5YzEMxz5n?p=preview

@cthrax
Copy link
Contributor

cthrax commented Apr 30, 2014

I've verified this is true on develop as well. Both with a value and a reference. http://plnkr.co/edit/JIFneB5rzcgK42gL8BJM?p=preview

@nmccready
Copy link
Contributor

Anyone want this?

@cthrax
Copy link
Contributor

cthrax commented Apr 30, 2014

I could take a look, but likely not until Sunday.

@nmccready
Copy link
Contributor

Done

@cthrax
Copy link
Contributor

cthrax commented May 5, 2014

I haven't been able to determine root cause on this yet, I'm suspecting though that the window is cloning the compiled element we pass them and therefore angular no longer has a reference to it, but I haven't been able to prove it. I can just see that the content in the window does not change, but the content in the directive does.

@nmccready
Copy link
Contributor

I am pretty sure #382 and this are dupes. It is probably related to show as using "show" is required now to get a Window visible.

@nmccready
Copy link
Contributor

BTW has anyone tries replacing the Window Reference? It may not be enough to change scope variables. Depends on how deep the watch is.

@cthrax
Copy link
Contributor

cthrax commented May 5, 2014

@nmccready I tried replacing a property on an object (versus a scalar) and an object itself, to no effect.

@nmccready
Copy link
Contributor

crap, well I'll get to it after I do 154, and 74.

@nmccready
Copy link
Contributor

Which directives are causing the issue? markers w windows? or markers w window? If anyone is using markers with windows.. I again will stress against this. markers w window is way better performance and memory wise. Especially if you only need to show a few (1 or more where starting from close) at a time based on click.

The only time windows is optimal is if you need all the windows open from the start. Or if your using Windows as your (css markers that are windows) markers.

@ghost
Copy link

ghost commented May 5, 2014

In my plunker I am only using a window. But in ticket #382, I'm using markers w window.
Either case, no windows

@cthrax
Copy link
Contributor

cthrax commented May 5, 2014

For posterity, I have a plnkr demonstrating that it's an issue with the way html is being compiled into the infowindow content. http://plnkr.co/edit/z9Ab89kbkHmFC2AXzTnD?p=preview . Not sure what to do about it at this point, but root cause is known now.

@nmccready
Copy link
Contributor

Issue #382 and this may go hand in hand. I am looking at 382 now but I may resolve this at the same time.

@nmccready
Copy link
Contributor

@cthrax if you continue on this, I would fix this in develop only.

@nmccready
Copy link
Contributor

@franklindner can you verify the same issue on the develop branch.

@nmccready
Copy link
Contributor

Ok this is with window, can anyone verify the issues with windows, and window, and windows inside marker or markers?

@nmccready
Copy link
Contributor

I am almost 100% positive this is the same issue as #382

@nmccready
Copy link
Contributor

I take that back this is an issue

@nmccready
Copy link
Contributor

I think @cthrax and myself have narrowed the issue down. One of us will get to it this evening.

@nmccready
Copy link
Contributor

We may have to do something similar to this (search for slit wrists) http://stackoverflow.com/questions/19304559/how-to-watch-the-dom-for-changes-angularjs . However we will be just checking for element.html() differences.

nmccready added a commit that referenced this issue May 8, 2014
window fixed
windows needs to pass interpolation down to the child as a service. This
needs to be called to evaluate the old html to the new.
@nmccready
Copy link
Contributor

I have some of it fixed, so far window is fixed. Still working on windows

@nmccready
Copy link
Contributor

@cthrax did you get anywhere with this as well?

@cthrax
Copy link
Contributor

cthrax commented May 14, 2014

@nmccready I did not. I tried watching the dom tree of the attached element and it did not fire on changes. Then I saw that you had fixed that part of it, so I didn't revisit.

@nmccready
Copy link
Contributor

@cthrax I figured it out and the fix is crazy simple for windows. I wish I would have thought of it before!

nmccready added a commit that referenced this issue May 14, 2014
window fixed
windows needs to pass interpolation down to the child as a service. This
needs to be called to evaluate the old html to the new.

version number fixed in package.json

ChildWindow position fix
- opts.position is now always updated when coords or element is changed

windows directive interpolation
- compiling is now initially forced into a fakeElement.html function
This allows the same logical structure to flow from Windows as from
Window Parent Models.
@nmccready nmccready assigned nmccready and unassigned cthrax May 14, 2014
@nmccready
Copy link
Contributor

fixed via 8f286b1

@cthrax
Copy link
Contributor

cthrax commented May 14, 2014

Nice, just always compile it. Hindsight is 20/20, but I'm feeling a little bit like "duh" now.

@knitzie
Copy link

knitzie commented Jun 23, 2015

Hi,
I just found this issue and updated the bower package on my project to solve my issue.
Now I've got a strange behaviour: After first click on the marker, the window opens empty. On second click, the content is available.
I forked a fiddle and add a random variable (windowOptions.show) to the html content:
http://jsfiddle.net/martgvd0/

FYI:
In my case, I want to update the window content with the markers data (like the address).

Does anyone else got this issue too?

@nmccready
Copy link
Contributor

@knitzie please create a new issue.

@angular-ui angular-ui locked and limited conversation to collaborators Jun 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants