Skip to content

Commit b3c7282

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

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
@@ -254,34 +254,6 @@ describe('bootstrap', () => {
254254
),
255255
);
256256
});
257-
258-
describe('bootstrapImpl', () => {
259-
it('should use a provided injector', inject([ApplicationRef], (ref: ApplicationRef) => {
260-
class MyService {}
261-
const myService = new MyService();
262-
263-
@Component({
264-
selector: 'injecting-component',
265-
template: `<div>Hello, World!</div>`,
266-
})
267-
class InjectingComponent {
268-
constructor(readonly myService: MyService) {}
269-
}
270-
271-
const injector = Injector.create({
272-
providers: [{provide: MyService, useValue: myService}],
273-
});
274-
275-
createRootEl('injecting-component');
276-
const appRef = ref as unknown as {bootstrapImpl: ApplicationRef['bootstrapImpl']};
277-
const compRef = appRef.bootstrapImpl(
278-
InjectingComponent,
279-
/* rootSelectorOrNode */ undefined,
280-
injector,
281-
);
282-
expect(compRef.instance.myService).toBe(myService);
283-
}));
284-
});
285257
});
286258

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

0 commit comments

Comments
 (0)