MCPcopy
hub / github.com/angular/angular / setNgReflectProperty

Function setNgReflectProperty

packages/core/src/render3/instructions/shared.ts:327–348  ·  view source on GitHub ↗
(lView: LView, tNode: TNode, attrName: string, value: any)

Source from the content-addressed store, hash-verified

325}
326
327function setNgReflectProperty(lView: LView, tNode: TNode, attrName: string, value: any) {
328 const environment = lView[ENVIRONMENT];
329 if (!environment.ngReflect) {
330 return;
331 }
332 const element = getNativeByTNode(tNode, lView) as RElement | RComment;
333 const renderer = lView[RENDERER];
334 attrName = normalizeDebugBindingName(attrName);
335 const debugValue = normalizeDebugBindingValue(value);
336 if (tNode.type & TNodeType.AnyRNode) {
337 if (value == null) {
338 renderer.removeAttribute(element as RElement, attrName);
339 } else {
340 renderer.setAttribute(element as RElement, attrName, debugValue);
341 }
342 } else {
343 const textContent = escapeCommentText(
344 `bindings=${JSON.stringify({[attrName]: debugValue}, null, 2)}`,
345 );
346 renderer.setValue(element as RComment, textContent);
347 }
348}
349
350export function setNgReflectProperties(
351 lView: LView,

Callers 2

setNgReflectPropertiesFunction · 0.85
setInputsFromAttrsFunction · 0.85

Calls 7

getNativeByTNodeFunction · 0.90
escapeCommentTextFunction · 0.90
removeAttributeMethod · 0.65
setAttributeMethod · 0.65
setValueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…