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
<!--quickAdd.cmp--> | |
<aura:component implements="force:lightningQuickAction" > | |
<lightning:input type="number" name="myNumber" aura:id="num1" label="Number 1"/> | |
<lightning:input type="number" name="myNumber" aura:id="num2" label="Number 2"/> | |
<br/> | |
<lightning:button label="Add" onclick="{!c.clickAdd}"/> | |
</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
/*quickAddController.js*/ | |
({ | |
clickAdd: function(component, event, helper) { | |
// Get the values from the form | |
var n1 = component.find("num1").get("v.value"); | |
var n2 = component.find("num2").get("v.value"); | |
// Display the total in a "toast" status message | |
var resultsToast = $A.get("e.force:showToast"); | |
resultsToast.setParams({ | |
"title": "Quick Add: " + n1 + " + " + n2, |
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="index" type="Integer" default="1" /> | |
<aura:attribute name="buttonLabel" type="String" /> | |
<div style="margin-top=20px;text-align:center;width=100%"> | |
<lightning:button variant="brand" label="Create Component" onclick="{! c.createComponent }" /> | |
<lightning:button variant="destructive" label="Remove Component" onclick="{! c.removeComponent }" /> | |
</div> | |
<br/><br/> | |
<div style="border:10px ridge red;height:50%;width:100%"> |
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
({ | |
createComponent : function(component, event, helper) { | |
var index = component.get("v.index"); | |
$A.createComponent( | |
"ui:Button", | |
{ | |
"label":"Button " + index, | |
"press":component.getReference("c.show") | |
}, | |
function(button) { |
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
<!--c:compEvent--> | |
<aura:event type="COMPONENT"> | |
<!-- pass context of where the event was fired to the handler. --> | |
<aura:attribute name="context" type="String"/> | |
</aura:event> | |
<!--c:appEvent--> | |
<aura:event type="APPLICATION"> |
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
<!--c:eventsNotifier--> | |
<aura:component> | |
<aura:attribute name="parentName" type="String"/> | |
<aura:registerEvent name="componentEventFired" type="c:compEvent"/> | |
<aura:registerEvent name="appEvent" type="c:appEvent"/> | |
<div> | |
<h3>This is {!v.parentName}'s eventsNotifier.cmp instance</h3> | |
<p> | |
<lightning:button label="Click here to fire a component event" onclick="{!c.fireComponentEvent}" /> | |
</p> |
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
<!--c:eventsHandler--> | |
<aura:component> | |
<aura:attribute name="name" type="String"/> | |
<aura:attribute name="mostRecentEvent" type="String" default="Most recent event handled:"/> | |
<aura:attribute name="numComponentEventsHandled" type="Integer" default="0"/> | |
<aura:attribute name="numApplicationEventsHandled" type="Integer" default="0"/> | |
<aura:handler event="c:appEvent" action="{!c.handleApplicationEventFired}"/> | |
<aura:handler name="componentEventFired" event="c:compEvent" action="{!c.handleComponentEventFired}"/> |
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:application extends="force:slds"> | |
<c:eventsHandler name="eventsHandler1"/> | |
<c:eventsHandler name="eventsHandler2"/> | |
</aura:application> |
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:application controller="echoController" extends="force:slds"> | |
<aura:attribute name="echoes" type="String[]"/> | |
<div class="slds-grid slds-wrap container"> | |
<div class="slds-size--3-of-12">Foreground Action</div> | |
<div class="slds-size--3-of-12">Background Action</div> | |
<div class="slds-size--3-of-12">Storable Action</div> | |
<div class="slds-size--3-of-12">Abortable Action</div> | |
<div class="slds-size--3-of-12"> |
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
({ | |
doForeground: function(cmp, event, helper) { | |
helper.echo(cmp, 'Foreground #1'); | |
helper.echo(cmp, 'Foreground #2'); | |
}, | |
doBackground: function(cmp, event, helper) { | |
helper.echo(cmp, 'Background #1', function(action) { | |
action.setBackground(); | |
}); |
OlderNewer