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

feat(ngRoute): add method $route.silent(path) for change location path without triggering route controller #5860

Closed
wants to merge 1 commit into from

Conversation

kulikov
Copy link

@kulikov kulikov commented Jan 17, 2014

No description provided.

@botverse
Copy link

I'd love to see something similar working, or be able to pass a URL to the search method so we can do URL changes without reloading the view.

@dejanr
Copy link

dejanr commented Jan 24, 2014

+1 for this, i have been stumbling around this issue for days, and finally settled with reloadOnSearch, and location.search. but its not perfect, my routes are not that clean cause i am using ? now.

Its more convenient for me to have normal route and use resolved param to decide showing or hiding some content, and eventually silently changing route when you have all dependencies on page already and you need to show some other sub content.

@carlosrymer
Copy link

+1

3 similar comments
@disintegrator
Copy link

+1

@joshhunt
Copy link

+1

@ndamnjanovic
Copy link

+1

@garakh
Copy link

garakh commented May 5, 2014

Couldnt wait the release. Published small angular module which adds silent routing change. Just define him before the ngRoute — https://github.com/garakh/ngSilent

@bioform
Copy link

bioform commented Jun 2, 2014

+1

@scottsword
Copy link

This PR was submitted almost a year ago. @btford looks like you gave this some attention back in August, any suggestions on having this pulled into 1.3.x?

@robustican
Copy link

+1

@marcalj
Copy link

marcalj commented Sep 7, 2015

I need the same function for query string update without triggering route controller! :)

Something like: $location.searchSilent('sf', SearchFilter.getForRouteParams());

@icruces
Copy link

icruces commented Sep 24, 2015

@marcalj That is possible with the option reloadOnSearch = false in your routeProvider configuration.

@marcalj
Copy link

marcalj commented Oct 17, 2015

@icruces Unfortunately if you set reloadOnSearch = false, when you change manually the query string AngularJS doesn't trigger anything, and it's a feature I need.

gkalpak added a commit to gkalpak/angular.js that referenced this pull request Aug 7, 2016
Enables users to specify that a particular route should not be reloaded after a URL change
(including a change in `$location.path()`), if the new URL maps to the same route.
The default behavior is still to always load the matched route when any part of the URL changes.

Related to angular#1699, angular#5860, angular#14999 (potentially closing the first two).
gkalpak added a commit to gkalpak/angular.js that referenced this pull request Jan 3, 2017
Enables users to specify that a particular route should not be reloaded after a
URL change (including a change in `$location.path()`), if the new URL maps to
the same route.
The default behavior is still to always load the matched route when any part of
the URL changes.

Related to angular#1699, angular#5860, angular#14999 (potentially closing the first two).

Fixes angular#7925
@Narretz Narretz modified the milestones: 1.5.x, 1.7.0 Apr 21, 2017
@gkalpak
Copy link
Member

gkalpak commented Oct 2, 2017

AFAICT, the main usecase is changing the URL to something that would match the same route (with different routeParams), but not re-instantiate the controller/view. Because changing the URL to something that does not match the same route (or no route at all) would break user expectations (such as reloading, deep-linking, etc).

If that is indeed the case, there is an alternative PR (#15002), which implements something equivalent with reloadOnSearch but for the whole URL. So, as long as the new URL maps to the same route, the route is not being "reloaded".

This has some benefits over this PR:

  • It is more predictable (being an explicit configuration option, rather than an imperative call).
  • Per-route configurable (which means less boilerplate - you configure it once, then don't care how the URL is changed).
  • More consistent with the existing $route API and .

My understanding (from reading through this thread) is that #15002 would cover the usecase people brought up here. Does anyone have a usecase that would not be covered?

@petebacondarwin
Copy link
Contributor

Closing in favour of #15002

gkalpak added a commit to gkalpak/angular.js that referenced this pull request May 23, 2018
Enables users to specify that a particular route should not be reloaded after a
URL change (including a change in `$location.path()`), if the new URL maps to
the same route.
The default behavior is still to always load the matched route when any part of
the URL changes.

Related to angular#1699, angular#5860, angular#14999 (potentially closing the first two).

Fixes angular#7925
gkalpak added a commit to gkalpak/angular.js that referenced this pull request May 26, 2018
Enables users to specify that a particular route should not be reloaded after a
URL change (including a change in `$location.path()`), if the new URL maps to
the same route.
The default behavior is still to always load the matched route when any part of
the URL changes.

Related to angular#1699, angular#5860, angular#14999 (potentially closing the first two).

Fixes angular#7925
gkalpak added a commit to gkalpak/angular.js that referenced this pull request Jun 7, 2018
Enables users to specify that a particular route should not be reloaded after a
URL change (including a change in `$location.path()`), if the new URL maps to
the same route.
The default behavior is still to always load the matched route when any part of
the URL changes.

Related to angular#1699, angular#5860, angular#14999 (potentially closing the first two).

Fixes angular#7925
gkalpak added a commit that referenced this pull request Jun 8, 2018
Enables users to specify that a particular route should not be reloaded after a
URL change (including a change in `$location.path()`), if the new URL maps to
the same route.
The default behavior is still to always load the matched route when any part of
the URL changes.

Related to #1699, #5860, #14999 (potentially closing the first two).

Fixes #7925

Closes #15002
gkalpak added a commit that referenced this pull request Jun 8, 2018
Enables users to specify that a particular route should not be reloaded after a
URL change (including a change in `$location.path()`), if the new URL maps to
the same route.
The default behavior is still to always load the matched route when any part of
the URL changes.

Related to #1699, #5860, #14999 (potentially closing the first two).

Fixes #7925

Closes #15002
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.