MCPcopy
hub / github.com/angular/angular / prepareEnvironment

Function prepareEnvironment

packages/platform-server/test/dom_utils.ts:143–152  ·  view source on GitHub ↗
(doc: Document, html: string)

Source from the content-addressed store, hash-verified

141 * @returns a promise with the application ref
142 */
143export function prepareEnvironment(doc: Document, html: string) {
144 insertDomInDocument(doc, html);
145 globalThis.document = doc;
146 const scripts = doc.getElementsByTagName('script');
147 for (const script of Array.from(scripts)) {
148 if (script?.textContent?.startsWith('window.__jsaction_bootstrap')) {
149 eval(script.textContent);
150 }
151 }
152}
153
154/**
155 * This bootstraps an application with existing html and enables hydration support

Callers 2

Calls 1

insertDomInDocumentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…