MCPcopy Create free account
hub / github.com/angular/angular / createRootLViewEnvironment

Function createRootLViewEnvironment

packages/core/src/render3/component_ref.ts:147–175  ·  view source on GitHub ↗
(rootLViewInjector: Injector)

Source from the content-addressed store, hash-verified

145}
146
147function createRootLViewEnvironment(rootLViewInjector: Injector): LViewEnvironment {
148 const rendererFactory = rootLViewInjector.get(RendererFactory2, null);
149 if (rendererFactory === null) {
150 throw new RuntimeError(
151 RuntimeErrorCode.RENDERER_NOT_FOUND,
152 ngDevMode &&
153 'Angular was not able to inject a renderer (RendererFactory2). ' +
154 'Likely this is due to a broken DI hierarchy. ' +
155 'Make sure that any injector used to create this component has a correct parent.',
156 );
157 }
158
159 const sanitizer = rootLViewInjector.get(Sanitizer, null);
160 const changeDetectionScheduler = rootLViewInjector.get(ChangeDetectionScheduler, null);
161 const tracingService = rootLViewInjector.get(TracingService, null, {optional: true});
162
163 let ngReflect = false;
164 if (typeof ngDevMode === 'undefined' || ngDevMode) {
165 ngReflect = rootLViewInjector.get(NG_REFLECT_ATTRS_FLAG, NG_REFLECT_ATTRS_FLAG_DEFAULT);
166 }
167
168 return {
169 rendererFactory,
170 sanitizer,
171 changeDetectionScheduler,
172 ngReflect,
173 tracingService,
174 };
175}
176
177function createHostElement(componentDef: ComponentDef<unknown>, renderer: Renderer): RElement {
178 // Determine a tag name used for creating host elements when this component is created

Callers 1

createMethod · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected