How to pass multiple data to child component using @Input
I have a question, what if we want to pass multiple data to a child component using @Input
how to do it.
If we have something like this:
<ex-comp [exData1]="exampleData1" [exData2]="exampleData2"></ex-comp>
How to get data in child component. Using two @Input
s?
-
If so, how do we know which data is included
@Input
? Questions for ordering? -
If not, how can this be achieved?
Sorry if I missed the base point on this.
Thank..
source to share
You can achieve this in the child component by this
@Input()exData1;
@Input()exData2;
<ex-comp [exData1]="exampleData1" [exData2]="exampleData2"></ex-comp>
Here exampleData1
and exampleData2
are the data from your parent component
and exData1
and exData2
are the input names that you can get in your child component by the above code.
source to share