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