Skip to content

unable to create a redirect for named outletΒ #33783

@aquark

Description

@aquark

🐞 bug report

Affected Package

The issue is caused by package @angular/router

Is this a regression?

Unsure.

Description

I have a named router outlet which I want to default by redirecting the empty path to one of the named paths, e.g.

{ outlet: 'test', path: '', pathMatch: 'full', redirectTo: 'default' },
{ outlet: 'test', path: 'default', component: TestComponent },

This worked when the configuration was in a lazy loaded module, however moving it to the root router configuration now fails to validate. This configuration seems like it should be valid. The only workaround I could find was to use an absolute path, e.g.

{ path: 'test', pathMatch: 'full', redirectTo: '/test/(test:default)' },

πŸ”¬ Minimal Reproduction

https://stackblitz.com/edit/angular-issue-repro2-fikqg2

πŸ”₯ Exception or Error


Error: Invalid configuration of route 'test/': a componentless route without children or loadChildren cannot have a named outlet set

🌍 Your Environment

Angular Version:


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.17
Node: 12.4.0
OS: darwin x64
Angular: 8.2.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       
@angular-devkit/build-angular   0.802.2
@angular-devkit/core            
@angular-devkit/schematics      
@angular/cdk                    7.3.7
@angular/cli                    8.3.17
@angular/material               7.3.7
@schematics/angular             
@schematics/update              
rxjs                            6.5.3
typescript                      3.5.3
webpack                         4.38.0

Anything else relevant?
Nope.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions