0
$stateProvider.state("browse", {
  url : "/browse/{id}",
  controller : "BrowseCtrl",
  templateUrl : "browse.html"
});

I will be frequently transitioning from /browse/1 to /browse/2 (and /browse/3 and /browse/400).

ui-router's natural behavior is to reload the template and reload the controller. That is not what I want.

What I want is for the controller (or somebody) to be notified "you used to be at /browse/1; now you are at /browse/2. Handle it." My code will update the screen as necessary (by doing a clever animation from 1 to 2).

If, however, the transition is from some other state, then I would like it to do the ordinary thing: load the template and the controller.

All my searches have turned up is fancy ways to animate transitions out of one state and into another, which is not what I want to do.

Nor (so far as I can tell) is this "sticky". A sticky state would maintain its scope from one invocation to another -- I want to keep the scope only as long as the transitions are within this state.

I am sure there is a keyword or an option or something for this, I just cannot find it.

EDIT: It occurs to me that I could accomplish all this if I could just mark {id} as not being important; that {id} changing does not constitute a transition and the only reaction to the change is that $stateParams is updated.

Michael Lorton
  • 43,060
  • 26
  • 103
  • 144

1 Answers1

0

I think best is to have different states, in your case browser.one, browser.two, browser.three and so on.

Check this detailed answer for sharing data between states.

Community
  • 1
  • 1
pitxon_net
  • 104
  • 8
  • So your idea is that I have 2^32 different states, one for each integer? – Michael Lorton May 07 '15 at 19:35
  • lol I guess what you'll need then is to add [states programmatically](http://stackoverflow.com/questions/25866387/angular-ui-router-programmatically-add-states) – pitxon_net May 08 '15 at 10:43