export class ParentComponent implements AfterViewInit {
@ViewChild(ChildComponent) child;
constructor() { }
productInParent=[];
ngAfterViewInit() {
this.productInParent = this.child.productInChild;
}
}
--child.ts
productInChild = [];
--Second Method
------------------------------------------------------------
--Child
@Output() onDatePicked = new EventEmitter<any>();
--Child
public pickDate(date: any): void {
this.onDatePicked.emit(date);
}
--Parent
<div>
<calendar (onDatePicked)="doSomething($event)"></calendar>
</div>
--Parent
public doSomething(date: any):void {
console.log('Picked date: ', date);
}