You need to sign in to do that
Don't have an account?

lightning component which is used in visualforce is not working
Not able to use Lightning Component in VF, below is my code
ComponentForVisualForce.cmp
ApplicationForVisualForce.app
ConsumeComponentForVisualForce.vfp
Regards
Madhusudan Singh
ComponentForVisualForce.cmp
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" > <lightning:button label="GoToRecord" title="Neutral action" onclick="{! c.handleClick }"/> </aura:component>ComponentForVisualForceController.js
({ handleClick : function(component, event, helper) { var navEvt = $A.get("e.force:navigateToSObject"); navEvt .setParams({ "recordId": "5006F00001w4IH7QAM", "slideDevName": "detail" }); navEvt.fire(); } })Created LightningOut Application as below
ApplicationForVisualForce.app
<aura:application extends="ltng:outApp" > <aura:dependency resource="markup://force:navigateToSObject" type="EVENT"/> <aura:dependency resource="c:ComponentForVisualForce"/> </aura:application>Below is the VisualForce Which I am consuming it
ConsumeComponentForVisualForce.vfp
<apex:page > <apex:includeLightning /> <div id="LcDisplayId"></div> <script> $Lightning.use("c:ApplicationForVisualForce", function() { $Lightning.createComponent("c:ComponentForVisualForce", { }, "LcDisplayId", function(component) { }); }); </script> </apex:page>
Regards
Madhusudan Singh
Try editing your code with these lines :
ConsumeComponentForVisualForce.vfp
And take a look on this article as well:
http://peterknolle.com/lightning-components-in-visualforce/
Hope it helps..
Thanks,
Shivankur Naikwade
Controller:
Helper: