Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$route service should reload controllers only if hashPath changes #329

Closed
wants to merge 1 commit into from

Conversation

IgorMinar
Copy link
Contributor

No description provided.

if $route.watchHashPathOnly(true) is called, all subsequent route
reloads will be triggered only if hashPath and not hashSearch changes
@IgorMinar
Copy link
Contributor Author

I changed the patch and now I require users to call $route.watchHashPathOnly(true) in order to prevent hashSearch reloads.

I'm not super happy about this api, but I don't see any other way to get this fixed for impact quickly.

@groner
Copy link
Contributor

groner commented May 19, 2011

I can imagine having some routes to controllers that need the present functionality and some routes to controllers that watch their parameters.

Why not make this a route specific parameter?

$route.when('/foo/:id', { controller:'WatchesItsOwnParamsCtlr', refreshOnHashSearchChange: false });

@IgorMinar
Copy link
Contributor Author

thanks for the suggestion. the main issue is that $route was designed with a guarantee that regardless of how user opens a route URL it the same code path will execute to render the route view.

This means that in both of these scenarios we run the same code:

  • opening a url X from a bookmark
  • opening a different view of the same app and navigating to url X

not reloading the scope/controller when query params change breaks this guarantee, which opens a big can of worms.

for this reason we decided not to implement this feature for now

@IgorMinar
Copy link
Contributor Author

this was addressed in a different way. see dc0b0c7

@IgorMinar IgorMinar closed this Aug 24, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants