Created
July 12, 2018 17:26
-
-
Save Sunil02kumar/6ae98404cb29a4666b87e8c3294b97d9 to your computer and use it in GitHub Desktop.
Adding Lightning Components in VF Page and Passing Values from URL
This file contains hidden or 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="ltng:outApp" > | |
<aura:dependency resource="c:SK_LightningCmpForVF"/> | |
</aura:application> |
This file contains hidden or 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="ltngPassedInfoFromVF" type="string"/> | |
<aura:attribute name="ltngPassedAccountNameFromVF" type="string"/> | |
<div style="background-color:#E6E6FA;border-style: solid;height:200px;margin:5%;padding:2%;"> | |
<div class="slds-align--absolute-center"> | |
This is SK_LightningCmpForVF Component | |
</div> | |
<br/> | |
Display Account Name passed from VF page:-<b>{!v.ltngPassedAccountNameFromVF}</b> | |
<br/> | |
Display info passed from VF page:-<b>{!v.ltngPassedInfoFromVF}</b> | |
</div> | |
</aura:component> |
This file contains hidden or 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
<apex:page standardController="Account" sidebar="false" standardStylesheets="false"> | |
<apex:includeLightning /> | |
<div id="componentContainer" /> | |
<script> | |
var infoString = "{!JSENCODE($CurrentPage.parameters.infoString)}"; | |
$Lightning.use("c:SK_LightningAppForVF", function() { | |
$Lightning.createComponent("c:SK_LightningCmpForVF", | |
{ | |
ltngPassedAccountIdFromVF: "{!JSENCODE(Account.Name)}", | |
ltngPassedInfoFromVF : infoString | |
}, | |
"componentContainer", | |
function(cmp) { | |
console.log("SK_LightningAppForVF loaded successfully in VF page"); | |
} | |
); | |
}); | |
</script> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment