I have popular error about Angular 2. When I'm calling function from another component I face this error.
"Cannot read property 'onChange' of undefined at CD019.onChangeParent"
My codes below:
@ViewChild('testComponent') testComponent: CD020;
onChangeParent() {
this.testComponent.onChange;
}
and child component is
@Output() childChanged = new EventEmitter<string>();
onChange(value: string, test: string) {
this.childChanged.emit(value);
this.Test(test);
}
Thanks for your help already.
this.testComponent.onChange() //added ()CD020?