MCPcopy
hub / github.com/angular/angular / bindingUpdated

Function bindingUpdated

packages/core/src/render3/bindings.ts:44–85  ·  view source on GitHub ↗
(lView: LView, bindingIndex: number, value: any)

Source from the content-addressed store, hash-verified

42 * `CheckNoChangesMode`)
43 */
44export function bindingUpdated(lView: LView, bindingIndex: number, value: any): boolean {
45 ngDevMode &&
46 assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
47
48 if (value === NO_CHANGE) {
49 return false;
50 }
51
52 const oldValue = lView[bindingIndex];
53
54 if (Object.is(oldValue, value)) {
55 return false;
56 } else {
57 if (ngDevMode && isInCheckNoChangesMode()) {
58 // View engine didn't report undefined values as changed on the first checkNoChanges pass
59 // (before the change detection was run).
60 const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
61 if (!devModeEqual(oldValueToCompare, value)) {
62 const details = getExpressionChangedErrorDetails(
63 lView,
64 bindingIndex,
65 oldValueToCompare,
66 value,
67 );
68 throwErrorIfNoChangesMode(
69 oldValue === NO_CHANGE,
70 details.oldValue,
71 details.newValue,
72 details.propName,
73 lView,
74 );
75 }
76 // There was a change, but the `devModeEqual` decided that the change is exempt from an error.
77 // For this reason we exit as if no change. The early exit is needed to prevent the changed
78 // value to be written into `LView` (If we would write the new value that we would not see it
79 // as change on next CD.)
80 return false;
81 }
82 lView[bindingIndex] = value;
83 return true;
84 }
85}
86
87/** Updates 2 bindings if changed, then returns whether either was updated. */
88export function bindingUpdated2(lView: LView, bindingIndex: number, exp1: any, exp2: any): boolean {

Callers 15

ɵɵpureFunction5Function · 0.90
pureFunction1InternalFunction · 0.90
pureFunctionVInternalFunction · 0.90
inputBindingUpdateFunction · 0.90
ɵɵconditionalFunction · 0.90
ɵɵrepeaterFunction · 0.90
ɵɵpropertyFunction · 0.90
ɵɵdomPropertyFunction · 0.90
checkStylingPropertyFunction · 0.90
checkStylingMapFunction · 0.90
ɵɵinterpolateFunction · 0.90

Calls 5

assertLessThanFunction · 0.90
isInCheckNoChangesModeFunction · 0.90
devModeEqualFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…