10

Is it possible to show a Lightning Component/App inside a Visualforce Page??

19

Hope this helps. I just had superb results embedding my entire component with Salesforce data tables,html, etc. into a visualforce page...not just a button calling a js script.

Step 1: your aura application should be global and extend ltng:outApp:

<aura:application access="GLOBAL" extends="ltng:outApp">

Step 2: add a dependency to your application:

<aura:dependency resource="c:MyAuraLgtComponent"/>

Step 3: In your visualforce page:

<apex:includeScript value="/lightning/lightning.out.js" />

Step 4: In your visualforce page:

<div id="lightning" />

    <script>
        $Lightning.use("c:MyApp", function() {
          $Lightning.createComponent("yourNamespace:MyAuraLgtComponent",
          { label : "" },
          "lightning",
          function(cmp) {
            // do some stuff
          });
        });
    </script>

Make sure that the component you are creating with $Lightning.createComponent() has the same name as the component you would like to display on the visual force page.

  • Seems to take a couple of seconds before any UI is rendered in my simple test from the docs. Do you see the same kind of delay? – Keith C Oct 15 '15 at 17:28
4

In Winter '16 you can use Lightning Components for Visualforce (LC4VF) to embed Lightning Components directly into a Visualforce page. Look for more on this starting next week at Dreamfoce.

Also, please don't use iFrames to embed Lightning Apps in Visualforce. This will be blocked starting in Winter '16, and there is no workaround, setting, etc. as this is a requirement from product security.

1

Thanks, @VamsiKrishna. Somehow, i missed to look into FAQs, so currently this is not feasible to embed Visualforce / LightningComponent into each other.

Ref: https://developer.salesforce.com/page/Lightning_FAQ#Visualforce_and_Lightning

-2

From winter16 you can.

Plz follow this link for reference.

http://forcewizard.com/blog/expose-your-lightning-components-visualforce-page

  • The link is broken – Robs Jul 31 '18 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.