MCPcopy Index your code
hub / github.com/angular/angular / appendServerContextInfo

Function appendServerContextInfo

packages/platform-server/src/utils.ts:145–155  ·  view source on GitHub ↗

* Adds the `ng-server-context` attribute to host elements of all bootstrapped components * within a given application.

(applicationRef: ApplicationRef)

Source from the content-addressed store, hash-verified

143 * within a given application.
144 */
145function appendServerContextInfo(applicationRef: ApplicationRef) {
146 const injector = applicationRef.injector;
147 let serverContext = sanitizeServerContext(injector.get(SERVER_CONTEXT, DEFAULT_SERVER_CONTEXT));
148 applicationRef.components.forEach((componentRef) => {
149 const renderer = componentRef.injector.get(Renderer2);
150 const element = componentRef.location.nativeElement;
151 if (element) {
152 renderer.setAttribute(element, 'ng-server-context', serverContext);
153 }
154 });
155}
156
157function insertEventRecordScript(
158 appId: string,

Callers 1

renderInternalFunction · 0.85

Calls 4

sanitizeServerContextFunction · 0.85
getMethod · 0.65
setAttributeMethod · 0.65
forEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…