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

Passing values from vf page to lightning component through a shared controller
Hello everyone,
Is there any way to pass the value of an input text field in the vf page to lightning component, through a shared controller??
Thank You
Aakanksha Singh
Is there any way to pass the value of an input text field in the vf page to lightning component, through a shared controller??
Thank You
Aakanksha Singh
http://cloudyworlds.blogspot.com/2016/02/lightning-events-via-visualforce.html
Thanks fo answering, but I don't have to use app, in my case lightning component itself is a tab.
Thanks once again
<pre><!--Lightning Component--><aura:component controller="recieveVal">
<aura:attribute name="vfVal" type="String" default=""/>
<aura:attribute name="ifmsrc" type="String" default=""/>
<aura:handler name="init" value="{!this}" action="{!c.myAction}"/>
{!v.vfVal}
<ui:button press="{!c.getValue}">Get Value</ui:button><br/><br/>
<iframe id="myFrame" style="border: 1px solid" src="{!v.ifmsrc}" />
</aura:component></pre>
<pre>//component controller
({
myAction : function(component, event, helper) {
component.set("v.ifmsrc", 'https://wk-aakanksha-dev-ed.lightning.force.com/apex/recieveVal');
},
getValue : function(component, event, helper) {
var action = component.get("c.getVfVal");
action.setCallback(this,function(a){
var state = action.getState();
if(state=="SUCCESS"){
component.set("v.vfVal",a.getReturnValue());
}
});
$A.enqueueAction(action);
var d = new Date();
var n = d.getTime();
component.set("v.ifmsrc", 'https://wk-aakanksha-dev-ed.lightning.force.com/apex/recieveVal?t='+ n+'&var='+val );
}
})</pre>
<pre>//Apex Controller
public with sharing class recieveVal {
public static string VfPageVar{get; set;}
public static void sendValue(){
if(str != VfPageVar){
str = VfPageVar;
}
}
private static string str;
@AuraEnabled
public static string getVfVal(){
showData.sendValue();
return str;
}
}</pre>
<pre><!--Vf page-->
<apex:page controller="recieveVal" showHeader="false" standardStylesheets="false">
<apex:form id="theform">
<apex:inputText value="{!VfPageVar}">
<apex:actionSupport event="onchange" action ="{!sendValue}"/>
</apex:inputText>
page variable:
<apex:outputText value="{!VfPageVar}" id="VfPage"/>
</apex:form>
</apex:page></pre>
i have a one question what is showData.sendValue(); (line number14 on apex class) ?
Thanks