From 9d48e534e253fc708b92cd8039b03aa8b6a28ee7 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Wed, 22 Oct 2025 16:48:31 +0200 Subject: [PATCH] Revert "feat(router): allow router outlet to be set on ng-container (#64562)" (#64584) This reverts commit 2bd764a3c416a3a513b69c894816d4f4db927bfc. PR Close #64584 --- goldens/public-api/router/index.api.md | 2 +- .../router/src/directives/router_outlet.ts | 2 +- .../test/directives/router_outlet.spec.ts | 25 ------------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/goldens/public-api/router/index.api.md b/goldens/public-api/router/index.api.md index 19e43db9e47..f0793957bc2 100644 --- a/goldens/public-api/router/index.api.md +++ b/goldens/public-api/router/index.api.md @@ -901,7 +901,7 @@ export class RouterOutlet implements OnDestroy, OnInit, RouterOutletContract { readonly routerOutletData: i0.InputSignal; readonly supportsBindingToComponentInputs = true; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } diff --git a/packages/router/src/directives/router_outlet.ts b/packages/router/src/directives/router_outlet.ts index 02a69df0766..516c0752533 100644 --- a/packages/router/src/directives/router_outlet.ts +++ b/packages/router/src/directives/router_outlet.ts @@ -204,7 +204,7 @@ export interface RouterOutletContract { * @publicApi */ @Directive({ - selector: 'router-outlet, ng-container[routerOutlet]', + selector: 'router-outlet', exportAs: 'outlet', }) export class RouterOutlet implements OnDestroy, OnInit, RouterOutletContract { diff --git a/packages/router/test/directives/router_outlet.spec.ts b/packages/router/test/directives/router_outlet.spec.ts index 5f8f690cd92..a5b197fb570 100644 --- a/packages/router/test/directives/router_outlet.spec.ts +++ b/packages/router/test/directives/router_outlet.spec.ts @@ -194,31 +194,6 @@ describe('router outlet name', () => { // Not contain because route was changed back to parent expect(fixture.nativeElement.innerHTML).not.toContain('child component'); }); - - it('should be able to use a router outlet on an ng-container', async () => { - @Component({ - template: '', - imports: [RouterOutlet], - }) - class RootCmp { - name = 'popup'; - } - - @Component({ - template: 'popup component', - }) - class PopupCmp {} - - TestBed.configureTestingModule({ - imports: [RouterModule.forRoot([{path: '', outlet: 'popup', component: PopupCmp}])], - }); - const router = TestBed.inject(Router); - const fixture = await createRoot(router, RootCmp); - - expect(fixture.nativeElement.innerHTML.trim()).toBe( - 'popup component', - ); - }); }); describe('component input binding', () => {