You need to sign in to do that
Don't have an account?
Kanhaiya Yadav 4
Regarding to Lighting Development.
Hi,
I am new in lightning. I am making one module in lightning, which have 4 or 5 buttons to do different activities. Should I create different component for each button or developments in the same (Base) component.
Thanks & Regards,
Kanahaiya
I am new in lightning. I am making one module in lightning, which have 4 or 5 buttons to do different activities. Should I create different component for each button or developments in the same (Base) component.
Thanks & Regards,
Kanahaiya
You can define 4-5 or more buttons in a single component with different unique Id and can write your logic into controller by getting the reference of a particulae with the help of aura:id . Regards
Sandeep Yadav
Thanks for reply.
My question was, should i create different component for each button or write code in base component ?.
Suppose i have 3 buttons add, edit, some other .
<lightning:button variant="brand" label="New" title="new" onclick="{! c.AddProduct}" />
<lightning:button variant="brand" label="Edit" title="new" onclick="{! c.EditProduct}" />
<lightning:button variant="brand" label="Delete" title="new" onclick="{! c.DeleteProduct}" />
What is best practices ?
Create different components for each action Or Write code in same component(Base Component). ?
Thanks,
Kanhaiya
No, There is no need for creating different component for different button.
Your action goes in javascript controller and you can define more than one method in controller section by seperating them with comma.