10

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

DDCody
  • 303
  • 1
  • 2
  • 9
  • 1
    u shd refer this discussion http://salesforce.stackexchange.com/questions/54534/now-that-lightning-is-here-whats-the-future-of-visualforce-in-short-visual which has reference to FAQ https://developer.salesforce.com/page/Lightning_FAQ#Visualforce_and_Lightning talking about VF & Lightning – Vamsi Krishna Gosu Sep 07 '15 at 12:05
  • Thanks, @VamsiKrishna. Somehow, i missed to look into FAQs, so currently this is not feasible to embed Visualforce / LightningComponent into each other. – DDCody Sep 07 '15 at 15:55

4 Answers4

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.

amanda fouts
  • 489
  • 3
  • 11
  • 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.

Skip Sauls
  • 2,580
  • 18
  • 14
  • Hi Skip, can you share a link to the documentation for "Lightning Components for Visualforce (LC4VF)"? All my research points me back to https://developer.salesforce.com/docs/atlas.en-us.198.0.lightning.meta/lightning/components_visualforce.htm - which isn't LC4VF, right? – Uwe Heim Oct 30 '15 at 11:14
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

DDCody
  • 303
  • 1
  • 2
  • 9
-2

From winter16 you can.

Plz follow this link for reference.

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

Monish
  • 551
  • 1
  • 4
  • 21