Let's say I am working with a component that requires three separate inputs, named input1
, input2
, and input3
.
export class exampleComponent {
@Input() input1:string;
@Input() input2:string;
@Input() input3:string;
....
...
}
In the parent component, there is an object structured as follows:
args = {
input1: "string1",
input2: "string2",
input3: "string3"
}
What would be the most effective approach to passing these key-value pairs from the object as arguments to the exampleComponent
? It should be noted that not all inputs are required in exampleComponent
, and the args
object may not always contain all three values.
I am looking for suggestions on how to achieve this without directly passing the entire object as an input to the testComponent. Your insights are greatly appreciated. Thank you.