| 145 | } |
| 146 | |
| 147 | function 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 | |
| 177 | function createHostElement(componentDef: ComponentDef<unknown>, renderer: Renderer): RElement { |
| 178 | // Determine a tag name used for creating host elements when this component is created |