Skip to content

(Router) Annoying redirect to home when some error occurs with lazy loaded modules #26993

@iget-master

Description

@iget-master

🐞 bug report

Affected Package

The issue is caused by @angular/router

Is this a regression?

No.

Description

Always that some error occurs on some page, the angular redirects the page to the root.

The problem is that when you are developing, this is annoying because always that you miss some module, you do:

  1. Try your url: localhost:4200/my/route/that/may/be/complex
  2. Angular will fail, console.log the reason, then redirect your to localhost:4200
  3. Now I go to the code, fix the issue, for example a missing module
  4. When I go back to the browser, I'm not on that long route, because angular decided to redirect me back to the root.
  5. I will need to type all that long URL again, and again, and again.

🔬 Minimal Reproduction

https://angular-issue-repro2-mc6ujx.stackblitz.io

🔥 Exception or Error

None.

🌍 Your Environment

Angular Version:


Angular CLI: 7.0.4
Node: 8.12.0
OS: linux x64
Angular: 7.0.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.10.4
@angular-devkit/build-angular     0.10.4
@angular-devkit/build-optimizer   0.10.4
@angular-devkit/build-webpack     0.10.4
@angular-devkit/core              7.0.4
@angular-devkit/schematics        7.0.4
@angular/cli                      7.0.4
@ngtools/webpack                  7.0.4
@schematics/angular               7.0.4
@schematics/update                0.10.4
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.19.1

Anything else relevant?

No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions