Created
November 23, 2016 10:16
-
-
Save danic85/d56e11650783e7fd6f635e962da3d79b to your computer and use it in GitHub Desktop.
Control visibility of lightning component using slds-hide
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
<!-- Component Markup --> | |
<div aura:id="yourIdentifier"> | |
<c:Your_Component /> | |
</div> | |
/** | |
* Controller Method | |
*/ | |
showComponent : function (component, event, helper) { | |
$A.util.removeClass(component.find("yourIdentifier"), "slds-hide"); | |
}, | |
hideComponent : function (component, event, helper) { | |
$A.util.addClass(component.find("yourIdentifier"), "slds-hide"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is great, didn't know about 'slds-hide'. I'd provide an improvement by using
$A.util.toggleClass
. Can simplify this to a single method like so: