Created
March 23, 2017 13:41
-
-
Save pozil/a3c329063871f255b8887cc185f07af0 to your computer and use it in GitHub Desktop.
Lightning - Passing data down the component hierarchy via attributes and a change handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component> | |
<aura:attribute name="childAttribute" type="String"/> | |
<aura:handler name="change" value="{!v.childAttribute}" action="{!c.onChildAttributeChange}"/> | |
<aura:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
onChildAttributeChange : function (component, event, helper) { | |
console.log("Old value: " + event.getParam("oldValue")); | |
console.log("Current value: " + event.getParam("value")); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component> | |
<aura:attribute name="parentAttribute" type="String"/> | |
<c:childCopmponent childAttribute="{!v.parentAttribute}"/> | |
<aura:component> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment