+ Start a Discussion
Arvind Singh 68Arvind Singh 68 

How to call Lightning component by vf page?

Raj VakatiRaj Vakati
There are three steps to add Lightning components to a Visualforce page.
  1. Add the Lightning Components for Visualforce JavaScript library to your Visualforce page using the <apex:includeLightning/> component.
  2. Create and reference a Lightning app that declares your component dependencies.
  3. Write a JavaScript function that creates the component on the page using $Lightning.createComponent().

refer this link 

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm
 
Ajay K DubediAjay K Dubedi
Hi Arvind,

You can use this VisualforcePage and Put your component Name and Application name in this page.               
               
 <apex:page sidebar="false" showHeader="false" standardStylesheets="false" >
    <apex:includeLightning />

    <div id="BcSecuritiesDiv"></div>

    <script>
        $Lightning.use("c:Your Application Name", function() {
            $Lightning.createComponent("c:Your component Name",
                    {},
                    "BcSecuritiesDiv",
                    function(cmp) {
                        console.log('>>>>> App is hosted');
                    });
        });
    </script>
</apex:page>

--------Change your Application Name According this----------------------------

<aura:application description="BcSecuritiesApp" extends="ltng:outApp" access="global" implements="ltng:allowGuestAccess" >
    
</aura:application>

--------Change your Component Name According this----------------------------

<aura:component description="AssetFinance" controller="AssetFinance" implements="forceCommunity:availableForAllPageTypes" access="global">

Please let me know if you have any query.
Please mark it as best Answer if you find it helpful.

Thank You
Ajay Dubedi

 
Janaki Reddi 17Janaki Reddi 17
Hi Ajay, 

I want to create a vf page using a component from managed package , any help on how to do that . 
 
Mohd SarfrazMohd Sarfraz
Hi All,
How can I create visualforce(included lightning components) page for site?

Thanks,
Sarfraz