Changed change detection.
Until beta .16, if your view contains {{myArray}}, this binding will not be updated unless you change the reference to the array. For example, if you are push()elements in an array, the view will not be updated to show a new element. The explanation (well, it was), because the array reference has not changed, Angular change detection does not overestimate the binding. This beta.15 plunker demonstrates this behavior.
As of beta .16 (and therefore RC.1), everything is different. The binding {{myArray}}will now be updated even if the array reference has not changed! See RC.1 plunker .
I looked at ChangeLog for beta.16 and I see nothing that could explain this change in behavior (but maybe I missed something). Does anyone know what caused this change, and what else could be affected?
Plunger Code:
@Component({
selector: 'child',
template: `<p>child: {{arr}}`
})
export class Child {
@Input() arr;
}
@Component({
selector: 'my-app',
template: `{{title}} <p>parent: {{arr}}
<button (click)="modifyArray()">modify array</button>
<child [arr]="arr"></child>`,
directives: [Child]
})
export class AppComponent {
title = "Angular 2 beta.15"; // or "Angular 2 RC.1", as appropriate
arr = 'one two three'.split(' ');
modifyArray() {
this.arr.push('another');
console.log(this.arr);
}
}
source
share