We have a specific situation where we want to use just one component for all sObject related CRUD operations. I came across many examples on this site but they all expect you to define the aura:attribute tag upfront to bind the values. But in this case as we do not know the object upfront we could not know the fields upfront as well, hence not an easy task to define the aura:attribute tags for fields of all objects. Any suggestions on the approach?
1 Answer
You can use type="Object"
to give the attribute a generic type. Then you can pass any JavaScript object as the value.
<aura:attribute name="data" type="Object" />
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_attr_types_object.htm