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
    try by adding <apex:includeLightning /> tag in vf – Amit Mar 30 '17 at 13:00
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)

| improve this answer | |

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.