Created
June 25, 2017 10:38
-
-
Save Sunil02kumar/a806632678fa5e6264ebcb6a8d82fa1e to your computer and use it in GitHub Desktop.
Passing component attribute value from VF page to Lightning 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"> | |
| <apex:includeLightning /> | |
| <div id="compContainer" /> | |
| <!--Here here skforce in script is my org namespace. if you are not using namespace in your org, | |
| then simply use c. like c:VFPageApp, c:VFPageComponent etc--> | |
| <script> | |
| $Lightning.use("skforce:VFPageApp", function() { | |
| $Lightning.createComponent("skforce:VFPageComponent", | |
| {PassesValueFromVF:"{!JSENCODE(Account.Name)}"}, | |
| "compContainer", | |
| function(cmp) { | |
| console.log("c:VFPageApp loaded successfully in VF page"); | |
| } | |
| ); | |
| }); | |
| </script> | |
| </apex:page> |
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 access="GLOBAL" extends="ltng:outApp"> | |
| <c:VFPageComponent/> | |
| </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="PassesValueFromVF" type="string"/> | |
| Account name Passed from VF Page: {!v.PassesValueFromVF}" | |
| </aura:component> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment