Skip to content

Instantly share code, notes, and snippets.

@brianmfear
Created May 1, 2018 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianmfear/de57ea8aad4643df2738e444afadf426 to your computer and use it in GitHub Desktop.
Save brianmfear/de57ea8aad4643df2738e444afadf426 to your computer and use it in GitHub Desktop.
Demonstration of one-way binding vs two-way binding
<aura:application >
<aura:attribute name="demo" type="Boolean" default="{!true}" />
<aura:if isTrue="{#v.demo}">
Unbound Set
<aura:set attribute="else">
Unbound Unset
</aura:set>
</aura:if>
<hr />
<aura:if isTrue="{!v.demo}">
Bound Set
<aura:set attribute="else">
Bound Unset
</aura:set>
</aura:if>
<hr />
<ui:button label="Toggle" press="{!c.toggle}" />
</aura:application>
({
toggle: function(component, event, helper) {
component.set("v.demo", !component.get("v.demo"));
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment