I need to pass data from grandparent -> parent -> child component.
This is the grandparent html
<p>
Grant
<app-parent [child]="child" [other]="other"></app-parent>
</p>
Gratnt.ts
other = [{'name': 'abcd', age: 21},{'name': 'pqrs', age: 22}];
child = [];
getData() {
this.service().subscribe((res)=>{
this.child = res; })
Parent html
<p>
Parent
<app-table [child]="newKid" [other]="newKid2"></app-table>
</p>
parent.ts
@Input child = [];
@Input other = [];
newKid = [];
newKid2 = [];
process() {
//Process Data
this.newKid = this.child;
this.newKid2 = this.other;
}
table.html
<table>
<thead>
<tr *ngFor="let item of child"></tr>
</thead>
<tbody><tr *ngFor="let item of other"></tr></tbody>
</table>
table.ts
@Input child = [];
@Input other = [];
My Question is how to transfer data to nested chain component.?