feat(core): add pure expression support to view engine

Part of #14013
This commit is contained in:
Tobias Bosch
2017-01-20 09:21:09 -08:00
committed by Alex Rickabaugh
parent 0adb97bffb
commit 65417374f1
10 changed files with 508 additions and 101 deletions

View File

@ -39,8 +39,7 @@ export function textDef(constants: string[]): NodeDef {
element: undefined,
provider: undefined,
text: {prefix: constants[0]},
component: undefined,
template: undefined
pureExpression: undefined
};
}
@ -124,9 +123,13 @@ export function checkAndUpdateTextInline(
export function checkAndUpdateTextDynamic(view: ViewData, def: NodeDef, values: any[]) {
const bindings = def.bindings;
let changed = view.firstChange;
for (let i = 0; i < values.length && !changed; i++) {
changed = changed || checkAndUpdateBinding(view, def, i, values[i]);
let changed = false;
for (let i = 0; i < values.length; i++) {
// Note: We need to loop over all values, so that
// the old values are updates as well!
if (checkAndUpdateBinding(view, def, i, values[i])) {
changed = true;
}
}
if (changed) {
let value = '';