Skip to main content

Posts

Showing posts from September, 2017

Lightning Events - Component Events

Hey Guys , In my previous post we have seen how to pass value from Parent to Child. Now lets see how you can pass value from Child to parent. Lightning Event :  There are 2 types events and they are ' COMPONENT ' and ' APPLICATION ' event. 1st we will see how COMPONENT event works and here we will reuse the same components which you created in previous blog. Think like this. There is a child component(ChildComp1_PC1) which updates some value and you need that updated value in the parent component(ParentComp1).                 You are gonna remember these steps,         Step 1: Create an event        Step 2: Register that event in component (in our scenario we will register in child comp).        Step 3: When the event is fired, have a logic to capture that event. so first you will create an event and register that in a child component (cause it is the one who is going to fire in order to send some values to it's parent ) so registering the event

Lightning - Passing value from Parent Component to Child Component

Hey Guys, This post I will try to cover some of the basics of Lightning Event. So if you have reached this post, I am assuming you have got some basic knowledge of Lightning framework. So, In brief Lightning Framework (LF ) works based on component and event driven modal. So when I say component  based, you might have seen that most of the codes are broken in to component in lightning development. You will understand more when you start creating one. There are few scenarios I would like to explain. Scene 1: Parent Component has one child and i want to pass some value from Parent to it's Child. Scene 2:Vice Versa Now .  I want to pass some value from Child Comp to it's parent components. How will you do ? There are 2 ways For Scene 1 and they are Way 1. Passing the value as Attribute Way 2. Sending the values using Lightning Methods. Way 1 is pretty simple. You will create a Attribute inside component 2(Child Comp) and will pass the required va