(lView: LView, values: any[])
| 26 | * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise. |
| 27 | */ |
| 28 | export function interpolationV(lView: LView, values: any[]): string | NO_CHANGE { |
| 29 | ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values'); |
| 30 | let isBindingUpdated = false; |
| 31 | let bindingIndex = getBindingIndex(); |
| 32 | |
| 33 | for (let i = 1; i < values.length; i += 2) { |
| 34 | // Check if bindings (odd indexes) have changed |
| 35 | isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated; |
| 36 | } |
| 37 | setBindingIndex(bindingIndex); |
| 38 | |
| 39 | if (!isBindingUpdated) { |
| 40 | return NO_CHANGE; |
| 41 | } |
| 42 | |
| 43 | // Build the updated content |
| 44 | let content = values[0]; |
| 45 | for (let i = 1; i < values.length; i += 2) { |
| 46 | // The condition is to prevent an out-of-bound read |
| 47 | content += renderStringify(values[i]) + (i + 1 !== values.length ? values[i + 1] : ''); |
| 48 | } |
| 49 | |
| 50 | return content; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Creates an interpolation binding with 1 expression. |
no test coverage detected
searching dependent graphs…