How to use Lightning component into a Visualforce page
Sometimes, you might have a situation where you want to access your lightning component in the Salesforce classic view and here ltng:outApp comes into picture.
ltng:outApp : Is a component in the long namespace which is used to expose your lightning component outside of the lightning experience.
Sample Code
https://gist.github.com/sfcure/c276ac1bed8e988bee4d8397ee337653
We need to wrap a component in a lightning app and make sure that lightning app is extending the ltng:outApp component. Look at the below sample code.
https://gist.github.com/sfcure/c276ac1bed8e988bee4d8397ee337653#file-sampleapp-app
After creating the lightning app, we will have to create that lightning app in the VF page along with the lightning component in the script. In order to create these 2 resources, we will have to use apex:includeLightning tag.
apex:includeLightning – Includes the Lightning Components for Visualforce JavaScript library, lightning.out.js, from the correct Salesforce domain.
Look at the sample code which is creating the lightning app with it’s lightning component.
https://gist.github.com/sfcure/c276ac1bed8e988bee4d8397ee337653#file-samplecomponentinvf-page
As you can see in the above code, we have defined a
We have managed to see the lightning component in the VF page and here is the output.
