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

Function setupTransferState

modules/benchmarks/src/hydration/table.ts:54–63  ·  view source on GitHub ↗
(cols: string, rows: string)

Source from the content-addressed store, hash-verified

52}
53
54export function setupTransferState(cols: string, rows: string) {
55 const script = document.createElement('script');
56 script.id = 'ng-state';
57 script.type = 'application/json';
58 // This script contains hydration annotation for the `TableComponent` component.
59 // Note: if you change the `TableComponent` template, make sure to update this
60 // annotation as well.
61 script.textContent = `{"__nghData__":[{"t":{"3":"t0"},"c":{"3":[{"i":"t0","r":1,"t":{"2":"t1"},"c":{"2":[{"i":"t1","r":1,"x":${cols}}]},"x":${rows}}]}}]}`;
62 document.body.insertBefore(script, document.body.firstChild);
63}

Callers 1

main.tsFile · 0.90

Calls 2

createElementMethod · 0.65
insertBeforeMethod · 0.65

Tested by

no test coverage detected