Free Salesforce Developers Tutorials >

Chapter -14 Lighting Component Framework >

Create a Lightning Application Part – 4

Create a Lightning Application Part – 4

What You’ll Learn

S2 Labs

Example of Lightning Component (getting the record from record id)

<!-- HTML File -->

<aura:component controller="c.contactContainer">
    <aura:attribute name="contact" type="Contact" default="{'sObjectType':'Contact'}"/>
    <aura:handler event="aura:locationChange" action="{!c.locationChange}"/>
    <div class = "details">
    	<h1> {!v.contact.Name} </h1>
        <h3> {!v.contact.Account.Name} </h3>
        <p> {!v.contact.Phone} </p>
//JS File
 locationChange : function(component, event, helper) 
  var token = event.getParam("token");
    if(token!=null && token.indexOf('contact/')===0){       
     var contactId = token.substr(token.indexOf('/')+1);
      var action = component.get("c.findById");

Styling in Aura Components

.THIS p{
    margin : 20px 0px 2px 0px;

.THIS h1{
    margin : 0px 0px 10px 0px;
.THIS h3{
    margin : 4px 0px;

LWC Training

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Post a Comment

Your email address will not be published. Required fields are marked *