Add a Lightning application within a Visualforce page in Salesforce
<!-- create a lightning app with global access that extends lightning outApp-->
YourLightningComponent.app
<aura:application access="GLOBAL" extends="ltng:outApp">
<aura: dependency resource="lightning: button"/>
</aura: application>
<apex:page >
<apex:includeLightning />
<div id="lightningContainer"></div>
<script>
$Lightning.use("c:YourApp", function() {
$Lightning.createComponent(
"c:YourLightningComponent",
{},
"lightningContainer",
function(cmp) {
console.log("Component created successfully: ", cmp);
}
);
});
</script>
</apex:page>
Comments
Post a Comment