dotJEM / angular-routing

Enhanced state based routing for Angular applications!
https://dotjem.github.io/angular-routing/
MIT License
75 stars 9 forks source link

Provide an AnchorScroll replacement that gives more flexibility. #15

Closed jeme closed 11 years ago

jeme commented 11 years ago

This could also be another service that simply used AnchorScroll as default behavior (depending on it) and then extends it.

Things that should be possible is to scroll to elements defined by a route parameter etc.

jeme commented 11 years ago

E.g see: https://github.com/angular-ui/ui-router/issues/110#issuecomment-17470657

jeme commented 11 years ago

This isn't quite as easy as one could have hoped, as controllers etc. loads data into views causing re-rendering, the scrolling as is may actually scroll to a wrong location.

And waiting for the views to load fully is actually suddenly a difficult task inside Angular's design, unless we provide some sort of "signalling" for the developers to use inside controllers which i just feel is a bad idea all together.

So maybe turning this on it's head and providing the service combined with a directive that can then scroll ones it's element is loaded may provide a better option, although I could still see some cases where it would maybe scroll and then render new content above again causing the scroll location to be wrong.

jeme commented 11 years ago

https://github.com/dotJEM/angular-routing/commit/4694bea9b66ece59965dc718fbe4201b67b329c1 closes this issue for now, an improvement issue for this has been raised, but for now the functionality is in there at least.