0
<apex:page standardController="Opportunity">
    <apex:includeScript value="/lightning/lightning.out.js" />
    <script>
    var accountId = "{!$CurrentPage.parameters.id}";
        $Lightning.use("c:aimiaLgtrichTextInputapp", function() {
            $Lightning.createComponent(
                "c:aimiaLgtrichTextInput",
               {},
                "myVal",
                function(cmp) {
                    console.log("Component created!");
                    console.log(cmp);
                });
            });
    </script>
    <div id="myVal"></div>
</apex:page>
1
  • 1
    try by adding <apex:includeLightning /> tag in vf Mar 30, 2017 at 13:00

1 Answer 1

2

Make sure your app is globally accessible (i.e: extends ltng:outApp) and create a dependency for the components it uses.

<aura:application access="GLOBAL" extends="ltng:outApp"> 
    <aura:dependency resource="c:aimiaLgtrichTextInput"/>
</aura:application>

Then you can call it on the visualforce page using the code bellow:

<apex:page>
    <apex:includeLightning />

    <div id="myVal" />

    <script>
        $Lightning.use("c:aimiaLgtrichTextInputapp", function() {
          $Lightning.createComponent("c:aimiaLgtrichTextInput",
          { /*add your parameters, probably accountId*/ },
          "myVal",
          function(cmp) {
              console.log("Component created!");
              console.log(cmp);
          });
        });
    </script>
</apex:page>

It's probably safer to put the containing div ABOVE the scrip (so when the script is read it can find the div Id)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .