feat(core): add binding name to content changed error (#20352)
Adding the binding name to the error message recieved by the user gives extra context on what exactly changed. The tests are also updated to reflect the new error message. PR Close #20352
This commit is contained in:

committed by
Alex Eagle

parent
54e75766ad
commit
4556532c26
@ -98,9 +98,10 @@ export function checkBindingNoChanges(
|
||||
view: ViewData, def: NodeDef, bindingIdx: number, value: any) {
|
||||
const oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
||||
if ((view.state & ViewState.BeforeFirstCheck) || !devModeEqual(oldValue, value)) {
|
||||
const bindingName = def.bindings[def.bindingIndex].name;
|
||||
throw expressionChangedAfterItHasBeenCheckedError(
|
||||
Services.createDebugContext(view, def.nodeIndex), oldValue, value,
|
||||
(view.state & ViewState.BeforeFirstCheck) !== 0);
|
||||
Services.createDebugContext(view, def.nodeIndex), `${bindingName}: ${oldValue}`,
|
||||
`${bindingName}: ${value}`, (view.state & ViewState.BeforeFirstCheck) !== 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user