So I am able to pass a string to a child component but when I try to pass an array I get [object Object] as a string parameter.
Not sure why this is happening!
parent component html:
<app-channel-fields-list data="{{channelFields}}"></app-channel-fields-list>
Where channelFields is
const channelFields =[ { "name": "first_name", "description": "first name" } ]
Child component html:
{{data}}
<tr *ngFor=" hero in data">
<td>{{hero.name}}</td>
</tr>
Child component ts:
@Input() data;
ngOnInit() {
console.log('data', this.data); // this also prints [object Object], which is weird
}
So, not really sure what the issue is since it works perfectly for passing strings but not arrays!
Here is a youtube video with what it actually looks like: https://www.youtube.com/watch?v=1gsmnoVhEig
I found a similar question: Angular passing array from parent to child component
But I can't get the dang thing to work.