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

Function doDowngrade

packages/upgrade/src/common/src/downgrade_component.ts:228–258  ·  view source on GitHub ↗
(injector: Injector, moduleInjector: Injector)

Source from the content-addressed store, hash-verified

226 const finalModuleInjector = moduleInjector || parentInjector!;
227
228 const doDowngrade = (injector: Injector, moduleInjector: Injector) => {
229 const injectorPromise = new ParentInjectorPromise(element);
230 const facade = new DowngradeComponentAdapter(
231 element,
232 attrs,
233 scope,
234 ngModel,
235 moduleInjector.get(EnvironmentInjector),
236 injector,
237 $compile,
238 $parse,
239 info.component,
240 wrapCallback,
241 unsafelyOverwriteSignalInputs,
242 );
243
244 const projectableNodes = facade.compileContents(template);
245 const componentRef = facade.createComponentAndSetup(
246 projectableNodes,
247 isNgUpgradeLite,
248 info.propagateDigest,
249 );
250
251 injectorPromise.resolve(componentRef.injector);
252
253 if (ranAsync) {
254 // If this is run async, it is possible that it is not run inside a
255 // digest and initial input values will not be detected.
256 scope.$evalAsync(() => {});
257 }
258 };
259
260 const downgradeFn = !isNgUpgradeLite
261 ? doDowngrade

Callers 1

directiveFactoryFunction · 0.85

Calls 5

compileContentsMethod · 0.95
resolveMethod · 0.95
getMethod · 0.65
$evalAsyncMethod · 0.65

Tested by

no test coverage detected