MCPcopy
hub / github.com/angular/angular / replaceMetadata

Function replaceMetadata

packages/core/test/acceptance/hmr_spec.ts:2384–2401  ·  view source on GitHub ↗
(type: Type<unknown>, metadata: Component)

Source from the content-addressed store, hash-verified

2382 const CREATED_INITIALLY_MARKER = '__ngCreatedInitially__';
2383
2384 function replaceMetadata(type: Type<unknown>, metadata: Component) {
2385 ɵɵreplaceMetadata(
2386 type,
2387 () => {
2388 // TODO: the content of this callback is a hacky workaround to invoke the compiler in a test.
2389 // in reality the callback will be generated by the compiler to be something along the lines
2390 // of `MyComp[ɵcmp] = /* metadata */`.
2391 // TODO: in reality this callback should also include `setClassMetadata` and
2392 // `setClassDebugInfo`.
2393 (type as any)[ɵNG_COMP_DEF] = null;
2394 compileComponent(type, metadata);
2395 },
2396 [angularCoreEnv],
2397 [],
2398 null,
2399 '',
2400 );
2401 }
2402
2403 function expectHTML(element: HTMLElement, expectation: string) {
2404 const actual = element.innerHTML

Callers 1

hmr_spec.tsFile · 0.85

Calls 2

ɵɵreplaceMetadataFunction · 0.90
compileComponentFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…