Sounds similar to the "Previous States" in a project I just learned about 
(on Stackoverflow): 
http://christopherthielen.github.io/ui-router-extras/#/home

On Tuesday, September 30, 2014 10:57:44 PM UTC+2, Eric Eslinger wrote:
>
> Hey angular peeps. I am thinking that I want to build something that 
> interacts with UI-router, but replaces in some cases the logic of $state.go 
> with a stack-based push-pop system.
>
> That would work in places where the user has to do further action to 
> accomplish the thing that they are doing in their current state in a 
> somewhat-modular way. Examples: 
>
> if a user tries to visit a page that belongs to a community that they are 
> not a member of, they should go to the "join / about" community page.
>
> when linking internally to another page (in a wiki-cms thing), if the page 
> needs to be created, go to the page creation and return with the link.
>
> In both cases, these are behaviors which could be directly navigated to 
> (make new page, join community), but in some circumstances, success should 
> route to a specific place, possibly with specific view state already 
> present- the page edits are in progress when the link-to action happened, 
> for example.
>
> Thus far, I have handled these kinds of returnable actions by using 
> modals. I am starting to think that I use too many modals, and there are 
> also situations where the modal template and controller more or less have 
> to totally duplicate something that is already in existence in a regular 
> page somewhere.
>
> So basically: define a service that stashes the current view state in a 
> stack, calls state.go on the new state, and defines some state.pop 
> functionality that will pop the stack if possible and just do a default 
> state.go if the stack isn't present (if the user got directly to that state 
> manually). Then the controllers of states which can call state.push need to 
> check the stack to  see if there is some transient view state to override 
> from the pristine first-visit state.
>
> anyway, I'm noodling over this idea, I think that it will solve a lot of 
> my problems in the future. Anyone have any experience with this sort of 
> pattern?
>
> Eric
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to