Skip to content

Commit 422f06d

Browse files
atscottAndrewKushnir
authored andcommitted
Revert "fix(core): Fix runInContext for NgModuleRef injector (angular#46877)" (angular#46896)
This reverts commit 14081dc. PR Close angular#46896
1 parent f55224a commit 422f06d

2 files changed

Lines changed: 1 addition & 7 deletions

File tree

packages/core/src/render3/ng_module_ref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class NgModuleRef<T> extends viewEngine_NgModuleRef<T> implements Interna
9898
}
9999

100100
runInContext<ReturnT>(fn: () => ReturnT): ReturnT {
101-
return this._r3Injector.runInContext(fn);
101+
return this.injector.runInContext(fn);
102102
}
103103

104104
override destroy(): void {

packages/core/test/acceptance/environment_injector_spec.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,6 @@ describe('environment injector', () => {
141141
expect(returnValue).toBe(3);
142142
});
143143

144-
it('works with an NgModuleRef injector', () => {
145-
const ref = TestBed.inject(NgModuleRef);
146-
const returnValue = ref.injector.runInContext(() => 3);
147-
expect(returnValue).toBe(3);
148-
});
149-
150144
it('should make inject() available', () => {
151145
const TOKEN = new InjectionToken<string>('TOKEN');
152146
const injector = createEnvironmentInjector(

0 commit comments

Comments
 (0)