How to use / manipulate @Input()items in child-component.ts before we pass it to child-component.html? I'm getting empty object if console log in ngOnInit
child-component.ts
@Input()items: any[] = [];
parent.component.html
<child-component [items]="items"></child-component>
parent.component.ts
indexOrders() {
this.orderService
.indexOrders()
.subscribe(
(res) => {
this.items = res;
},
(err) => {
serviceHttpErrorHandler(err);
},
);
}
sample.json
sample response that passed to this.item
[
{
"text":"wood",
"value":"100"
},
{
"text":"chair",
"value":"200"
},
{
"text":"board",
"value":"300"
}
]
parent.component.htmlshould be<child-component [items]="items"></child-component>with brackets arounditemsattribute.itemsin child-component.ts file before pass to html?