Skip to content

Instantly share code, notes, and snippets.

@mtetlow
Created August 6, 2016 22:03
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 mtetlow/876171bec75c93c91d0396b4ebdc66a5 to your computer and use it in GitHub Desktop.
Save mtetlow/876171bec75c93c91d0396b4ebdc66a5 to your computer and use it in GitHub Desktop.
<aura:component implements="forceCommunity:availableForAllPageTypes,flexipage:availableForAllPageTypes,force:hasRecordId" controller="trTestCtrl" access="global">
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:attribute name="testStr" type="String" default="default value" />
<div>{!v.testStr}</div>
</aura:component>
({
doInit : function(component, event, helper) {
var action = component.get("c.getTest");
action.setCallback(this, function(response){
var state = response.getState();
if(state === "SUCCESS"){
var str = response.getReturnValue();
component.set('v.testStr', str);
}
});
$A.enqueueAction(action);
}
})
public with sharing class trTestCtrl {
public trTestCtrl() {
}
@AuraEnabled
public static String getTest(){
return 'yay from server';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment