(targetDirectiveIdx: number, publicName: string, value: unknown)
| 78 | // - move more logic to the first creation pass |
| 79 | // - move this function to under the instructions folder |
| 80 | function inputBindingUpdate(targetDirectiveIdx: number, publicName: string, value: unknown) { |
| 81 | const lView = getLView(); |
| 82 | const bindingIndex = nextBindingIndex(); |
| 83 | if (bindingUpdated(lView, bindingIndex, value)) { |
| 84 | const tView = lView[TVIEW]; |
| 85 | const tNode = getSelectedTNode(); |
| 86 | |
| 87 | const componentLView = getComponentLViewByIndex(tNode.index, lView); |
| 88 | markViewDirty(componentLView, NotificationSource.SetInput); |
| 89 | |
| 90 | // TODO(pk): don't check on each and every binding, just assert in dev mode |
| 91 | const targetDef = tView.directiveRegistry![targetDirectiveIdx]; |
| 92 | if (ngDevMode && !targetDef) { |
| 93 | throw new RuntimeError( |
| 94 | RuntimeErrorCode.NO_BINDING_TARGET, |
| 95 | `Input binding to property "${publicName}" does not have a target.`, |
| 96 | ); |
| 97 | } |
| 98 | |
| 99 | // TODO(pk): the hasSet check should be replaced by one-off check in the first creation pass |
| 100 | const hasSet = setDirectiveInput(tNode, tView, lView, targetDef, publicName, value); |
| 101 | |
| 102 | if (ngDevMode) { |
| 103 | if (!hasSet) { |
| 104 | throw new RuntimeError( |
| 105 | RuntimeErrorCode.NO_BINDING_TARGET, |
| 106 | `${stringifyForError(targetDef.type)} does not have an input with a public name of "${publicName}".`, |
| 107 | ); |
| 108 | } |
| 109 | storePropertyBindingMetadata(tView.data, tNode, publicName, bindingIndex); |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Creates an input binding. |
no test coverage detected
searching dependent graphs…