-
-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scroll spy with dinamically loaded content #41
Comments
Solved your case, but there might be other uses with ui-router that still has issues. It was firing events like crazy so I just skipped them and resorted to only |
Please, see example without ui-router: In this case template including scroll spy is loaded via ngInclude and thus does not change location. Here is the plunker that works with ui-router as well as with the example above.
This line provides rebinding anytime container does not exist in DOM. |
Your plunker introduces a jQuery dependency which I'm not comfortable with. Reverted previous changes and used a pure js implementation instead. |
It is better without jQuery for sure. Thanks! |
If the template containing scrolling markup is loaded dynamically, then scroll spy stops working after template was reloaded for the first time.
Example at http://plnkr.co/edit/FdECKs0ARM89qEB5xitv?p=preview demonstrates simple navigation between two documents, which of those represented by the same layout. If user clicks on 'Document 1', scroll spy works and
active
class is assigned to the links. However if user clicks on 'Document 2', scroll spy stops working. Only page reload can help.What happens here is that on dynamic reload container is destroyed while the context remains. I didn't figure out yet why exactly this happens. If it cannot be fixed I can suggest extend condition
(!context.container)
inaddSpy
function. In the example above, after user clicks on the second linkcontext.container
is not empty, it just not attached to the DOM.The text was updated successfully, but these errors were encountered: