Skip to content

Commit ae16c92

Browse files
committed
fix(core): adjust NgtRouterOutlet to make a new env injector with parent
1 parent b5d3ae6 commit ae16c92

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

libs/core/src/lib/routed-scene.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
ChangeDetectorRef,
33
Component,
4+
createEnvironmentInjector,
45
Directive,
56
effect,
67
EnvironmentInjector,
@@ -76,10 +77,15 @@ export class NgtRouterOutlet extends RouterOutlet {
7677
private environmentInjector = inject(EnvironmentInjector);
7778

7879
override activateWith(activatedRoute: ActivatedRoute, environmentInjector: EnvironmentInjector): void {
79-
return super.activateWith(
80-
activatedRoute,
81-
new NgtOutletEnvironmentInjector(environmentInjector, this.environmentInjector),
82-
);
80+
const activateWithEnvInjector =
81+
this.environmentInjector === environmentInjector
82+
? environmentInjector
83+
: createEnvironmentInjector(
84+
[],
85+
new NgtOutletEnvironmentInjector(environmentInjector, this.environmentInjector),
86+
);
87+
88+
return super.activateWith(activatedRoute, activateWithEnvInjector);
8389
}
8490
}
8591

0 commit comments

Comments
 (0)