MCPcopy
hub / github.com/angular/angular / initComponent

Method initComponent

packages/core/testing/src/test_bed.ts:708–718  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

706
707 const componentFactory = new ComponentFactory(componentDef);
708 const initComponent = () => {
709 const componentRef = componentFactory.create(
710 Injector.NULL,
711 [],
712 `#${rootElId}`,
713 this.testModuleRef,
714 undefined,
715 options?.bindings,
716 ) as ComponentRef<T>;
717 return this.runInInjectionContext(() => new ComponentFixture(componentRef));
718 };
719 const noNgZone = this.inject(ComponentFixtureNoNgZone, false);
720 const ngZone = noNgZone ? null : this.inject(NgZone, null);
721 const fixture = ngZone ? ngZone.run(initComponent) : initComponent();

Callers

nothing calls this directly

Calls 2

runInInjectionContextMethod · 0.95
createMethod · 0.65

Tested by

no test coverage detected