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

URL out of sync with ng-view after a $routeChangeError #2100

Open
@butchpeters

Description

@butchpeters
  1. Configure a route (e.g. '/causesError') containing a resolve property
  2. Load a good state in your application (e.g. the route '/goodRoute')
  3. User performs an action to load the route '/causesError'
  4. The resolve gets rejected, which causes $routeChangeError to be broadcast rather than $routeChangeSuccess.

Because there was no $routeChangeSuccess, the ng-view still contains content for '/goodRoute', but now the URL is changed to the failed route. They are out of sync.

Any attempt to change the URL back to '/goodRoute' in a $routeChangeError event handler would cause the '/goodRoute' to reload, which is not desirable.

One problem this causes is now the user can't retry the action that caused the error. In a mobile application, for example, they may have been experiencing intermittent connection loss. If they retry the same action, the location change events won't fire because the URL isn't changing, and therefore the route won't be reattempted.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions