Created
April 21, 2018 09:52
-
-
Save anilsomasundaran/76f84dc0a0503acbc22be7564a82001d to your computer and use it in GitHub Desktop.
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 extends="c:AbstractBase" controller="TestApexController"> | |
<aura:attribute name="message" type="String" default=""/> | |
<aura:attribute name="serverMessage" type="String" default="" description="server message assigns to this"/> | |
<aura:attribute name="showError" type="Boolean" default="false" /> | |
<aura:attribute name="showServerError" type="Boolean" default="false" /> | |
<ui:inputText label="Message" value="{!v.message}" /> | |
<lightning:input type="checkbox" label="Show Error" name="showErrorCheck" checked="{!v.showError}"/> | |
<lightning:button variant="brand" label="Send Message" onclick="{! c.sendMessage }" /> | |
<br/><br/><br/> | |
<aura:if isTrue="{!v.showServerError}"> | |
Server Message : {!v.serverMessage} | |
<aura:set attribute="else"> | |
Server Message : {!v.serverMessage} | |
</aura:set> | |
</aura:if> | |
</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
({ | |
sendMessage : function(component, event, helper) { | |
helper.sendMessage(component,helper); | |
} | |
}) |
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
({ | |
sendMessage : function (component,helper) { | |
var message = component.get("v.message"); | |
var showError = component.get("v.showError"); | |
var param = {"message":message,"showError":showError}; | |
helper.runServerMethod(component,"c.callApexControllerMethod",function(response){ | |
component.set("v.serverMessage",response.getReturnValue()); | |
}, function(errors) { | |
component.set("v.showServerError",true); | |
component.set("v.serverMessage",errors[0].message); | |
},param); | |
console.log(message,showError); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment