I updated from RC1 to RC2 and got this cryptic message - "Expression has changed after it was checked". The code is very simple.
The parent component has two children "sister" and "brother". Right after init, sister emits an event that is assigned to parent's variable and brother's Input()
property is bound to the same variable. I think this is "classic" communication between siblings components using parent's variable.
It used to work in RC1, but not is RC2. I checked CHANGELOG.md, but have found no clue. What am I doing wrong?
http://plnkr.co/edit/HMPAbImpWWeZrVjHyb6H?p=preview
import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'brother',
template:'<h2>Brother has {{present}}</h2>'
})
export class Brother{
@Input() present: string;
}
@Component({
selector: 'sister',
template:'<h2>Sister has {{_present}}</h2>'
})
export class Sister{
@Output() present: EventEmitter<string> = new EventEmitter;
public _present: string = 'something';
ngOnInit(){
this.present.emit(this._present);
}
}
@Component({
selector: 'my-app',
template: `
<div class="container">
<h2>Parent has {{present}}</h2>
<brother [present]="present"></brother>
<sister (present)="present=$event"></sister>
</div>
`,
directives:[Brother,Sister]
})
export class AppComponent {
public present: string;
}