Skip to main content
deleted 26 characters in body
Source Link
Charlotte G
  • 459
  • 1
  • 5
  • 15

I'm trying to get a link on a VF page in SF1 to navigate to a Lightning component. I can do Lightning-component-to-Lightning-component navigation, and Lightning-component-to-VF page navigation, but I'm struggling with the JavaScript syntax for VF-to-Lightning-component navigation.

Here's my code snippet - the JS is basically taken from the component-to-component nav snippet (which works a treat when launced via a ui:button press attribute in a Lightning component):

<apex:page showHeader="true" sidebar="true">

<script>
    function navToPlotList(devIddevIdin, devNamedevNamein){
      console.log('dev id: ' + devId);
      console.log('dev name: ' + devName);

          var button = $A.get("e.force:navigateToComponent");
          button.setParams({
            componentDef:"c:pb_plotList",
            componentAttributes: {
              devId: component.get("devId")devIdin,
              devName: component.get("devName")devNamein
            }

          });
          button.fire(); 
    }

</script>

<a href="#" onClick="navToPlotList('a06L000000GdS7X', 'TEST NAME')">Go to plot list</a>

</apex:page>

I know that the issue right now is with the $A on line 8, but I'm not sure what to replace this with in order to get this working. Also I'm not sure whether the button.fire(); will even work from JS in a VF page. Any thoughts?

I'm trying to get a link on a VF page in SF1 to navigate to a Lightning component. I can do Lightning-component-to-Lightning-component navigation, and Lightning-component-to-VF page navigation, but I'm struggling with the JavaScript syntax for VF-to-Lightning-component navigation.

Here's my code snippet - the JS is basically taken from the component-to-component nav snippet (which works a treat when launced via a ui:button press attribute in a Lightning component):

<apex:page showHeader="true" sidebar="true">

<script>
    function navToPlotList(devId, devName){
      console.log('dev id: ' + devId);
      console.log('dev name: ' + devName);

          var button = $A.get("e.force:navigateToComponent");
          button.setParams({
            componentDef:"c:pb_plotList",
            componentAttributes: {
              devId: component.get("devId"),
              devName: component.get("devName")
            }

          });
          button.fire(); 
    }

</script>

<a href="#" onClick="navToPlotList('a06L000000GdS7X', 'TEST NAME')">Go to plot list</a>

</apex:page>

I know that the issue right now is with the $A on line 8, but I'm not sure what to replace this with in order to get this working. Also I'm not sure whether the button.fire(); will even work from JS in a VF page. Any thoughts?

I'm trying to get a link on a VF page in SF1 to navigate to a Lightning component. I can do Lightning-component-to-Lightning-component navigation, and Lightning-component-to-VF page navigation, but I'm struggling with the JavaScript syntax for VF-to-Lightning-component navigation.

Here's my code snippet - the JS is basically taken from the component-to-component nav snippet (which works a treat when launced via a ui:button press attribute in a Lightning component):

<apex:page showHeader="true" sidebar="true">

<script>
    function navToPlotList(devIdin, devNamein){
      console.log('dev id: ' + devId);
      console.log('dev name: ' + devName);

          var button = $A.get("e.force:navigateToComponent");
          button.setParams({
            componentDef:"c:pb_plotList",
            componentAttributes: {
              devId: devIdin,
              devName: devNamein
            }

          });
          button.fire(); 
    }

</script>

<a href="#" onClick="navToPlotList('a06L000000GdS7X', 'TEST NAME')">Go to plot list</a>

</apex:page>

I know that the issue right now is with the $A on line 8, but I'm not sure what to replace this with in order to get this working. Also I'm not sure whether the button.fire(); will even work from JS in a VF page. Any thoughts?

Source Link
Charlotte G
  • 459
  • 1
  • 5
  • 15

SF1: navigateToComponent from Visualforce

I'm trying to get a link on a VF page in SF1 to navigate to a Lightning component. I can do Lightning-component-to-Lightning-component navigation, and Lightning-component-to-VF page navigation, but I'm struggling with the JavaScript syntax for VF-to-Lightning-component navigation.

Here's my code snippet - the JS is basically taken from the component-to-component nav snippet (which works a treat when launced via a ui:button press attribute in a Lightning component):

<apex:page showHeader="true" sidebar="true">

<script>
    function navToPlotList(devId, devName){
      console.log('dev id: ' + devId);
      console.log('dev name: ' + devName);

          var button = $A.get("e.force:navigateToComponent");
          button.setParams({
            componentDef:"c:pb_plotList",
            componentAttributes: {
              devId: component.get("devId"),
              devName: component.get("devName")
            }

          });
          button.fire(); 
    }

</script>

<a href="#" onClick="navToPlotList('a06L000000GdS7X', 'TEST NAME')">Go to plot list</a>

</apex:page>

I know that the issue right now is with the $A on line 8, but I'm not sure what to replace this with in order to get this working. Also I'm not sure whether the button.fire(); will even work from JS in a VF page. Any thoughts?