Skip to content

Commit d5a8a1c

Browse files
Revert "refactor(core): add ApplicationRef.prototype.bootstrapImpl with an injector parameter (#60622)" (#60669)
This reverts commit 7cb8639. PR Close #60669
1 parent 7cb8639 commit d5a8a1c

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

packages/core/src/application/application_ref.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,6 @@ export class ApplicationRef {
498498
bootstrap<C>(
499499
componentOrFactory: ComponentFactory<C> | Type<C>,
500500
rootSelectorOrNode?: string | any,
501-
): ComponentRef<C> {
502-
return this.bootstrapImpl(componentOrFactory, rootSelectorOrNode);
503-
}
504-
505-
private bootstrapImpl<C>(
506-
componentOrFactory: ComponentFactory<C> | Type<C>,
507-
rootSelectorOrNode?: string | any,
508-
injector: Injector = Injector.NULL,
509501
): ComponentRef<C> {
510502
profiler(ProfilerEvent.BootstrapComponentStart);
511503

@@ -540,7 +532,7 @@ export class ApplicationRef {
540532
? undefined
541533
: this._injector.get(NgModuleRef);
542534
const selectorOrNode = rootSelectorOrNode || componentFactory.selector;
543-
const compRef = componentFactory.create(injector, [], selectorOrNode, ngModule);
535+
const compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
544536
const nativeElement = compRef.location.nativeElement;
545537
const testability = compRef.injector.get(TESTABILITY, null);
546538
testability?.registerApplication(nativeElement);

packages/core/test/application_ref_spec.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -256,34 +256,6 @@ describe('bootstrap', () => {
256256
),
257257
);
258258
});
259-
260-
describe('bootstrapImpl', () => {
261-
it('should use a provided injector', inject([ApplicationRef], (ref: ApplicationRef) => {
262-
class MyService {}
263-
const myService = new MyService();
264-
265-
@Component({
266-
selector: 'injecting-component',
267-
template: `<div>Hello, World!</div>`,
268-
})
269-
class InjectingComponent {
270-
constructor(readonly myService: MyService) {}
271-
}
272-
273-
const injector = Injector.create({
274-
providers: [{provide: MyService, useValue: myService}],
275-
});
276-
277-
createRootEl('injecting-component');
278-
const appRef = ref as unknown as {bootstrapImpl: ApplicationRef['bootstrapImpl']};
279-
const compRef = appRef.bootstrapImpl(
280-
InjectingComponent,
281-
/* rootSelectorOrNode */ undefined,
282-
injector,
283-
);
284-
expect(compRef.instance.myService).toBe(myService);
285-
}));
286-
});
287259
});
288260

289261
describe('destroy', () => {

0 commit comments

Comments
 (0)