Method Names in Lightning Component Controllers vs Apex Controllers

In the Lightning Component docs, they tell you to use the following “c.” syntax when you want to reference the Javascript controller method from the component view: <ui:button label=”Click” press=”{!c.doJSMethod}” /> also in the docs, they show you how you can call an Apex method from the Javascript controller using the exact same notation: var […]

Custom Logout Button on Lightning Component in Community

If you want to create your own logout button for a Community Lightning Component, you can use the window.location.replace() javascript function. The button component (note: this example is the button only, you would typically include this in a Notification): <aura:component implements=”forceCommunity:availableForAllPageTypes” access=”global”> <ui:button label=”Logout” press=”{!c.logout}”/> </aura:component> And in your controller, you can redirect the user […]

TIL About Using Apex Controllers With Lightning Components

More importantly… I learned how to initialize Lightning Components from properties in an Apex Controller. My scenario: I wanted to display the detail page for a Contact in a lightning component.  Essentially the equivalent of “<apex:detail>” tag.  In Lightning, you can achieve this by using the “<force:recordView>” tag instead.  What I learned is that the […]

TIL about @AuraEnabled

When you’re using an <aura:attribute> that is an instance of a custom Apex Class, you need to use the following approach: Any methods in your class that you want to access from client-side logic must be declared as Static the @AuraEnabled annotation must be used on those methods as well Any properties of the class […]

#TIL

So I’ve decided to start adding a new type of blog post to this site in an effort to stay more consistently engaged with it (I’ve been slacking and not paying as much attention to it as I would like). I’m going to start posting Today I Learned (#TIL) posts in addition to the regular […]