Navigate to a independent Aura component from Visualforce Page

Hi Guys,

Today in this post we are going to learn on, How to navigate or Display Lightning Components on the click of a button from a Visualforce Page.  

Step 1 : Create Lightning Component [ lcFromVF.cmp ]

    <aura:attribute name="recordId" type="String" />
Step 2 : Create Visualforce Page [ lcVF.vfp ]
        <button onclick="NavigatetoauraComponent();" type="button">
            Navigate to aura Component
    function NavigatetoauraComponent(){
        var compDefinition = { 
			"componentDef" : "c:lcFromVF", 
			"attributes" :{ 
			  "recordTypeId" : "00Q2v00001fum80",
		// Base64 encode the compDefinition JS object
		var encodedCompDef = btoa(JSON.stringify(compDefinition));
		window.parent.location = "/one/"+encodedCompDef;

if you have any suggestions or issue with it, you can post in comment box.

Apex Coder


Popular posts from this blog

Lightning:input type date not displaying correctly