angular / router

The Angular 1 Component Router
MIT License
665 stars 135 forks source link

Sticky routes #255

Open gotenxds opened 9 years ago

gotenxds commented 9 years ago

Hi, I was wondering if there is any talk on sticky routes, its a feature that many requested from ui-router but never received (This was implemented in a ui-router plugin here https://github.com/christopherthielen/ui-router-extras)

Use case:

I have a couple of routes in my site (insertData, viewRelevantData, justSomeHeavyDutyStuff)

I first get into the insertData route and start inserting data, then i need to consult my relevant data for a few seconds so i change my route -> viewRelevantData, I get back -> insertData, and all my data is gone!

Now I know we can use the canDeactivate hook for this but I don't want to pest my user and I do want to allow him not to save half of the data. One soulution would be to save all the data in a service and then reload it onActivate. Another more dom heavy solution (But useful in some cases) would be sticky routes.

Another use case is my justSomeHeavyDutyStuff, lets say I have alot of data in this one, displayed in 10 ui-grids... this takes about 2-5 seconds to render (Just render, the json is hard-coded into the controller in my test.) Now I leave this route and return after a few seconds, it renders the route again even though the data did not change.

I would love it if it where possible to save the component in the "side" freezing its binding(So it wont update when not displayed.), and reactivating it when needed.

fratle commented 9 years ago

Sounds alot like #158. This feature is currently on the top of our wish list.