public string prop { get; set;}

I need to bind above apex controller property to lightning component. Please help me on this.

2 Answers 2


Use a method to set the value from VF page.


public static CLASSNAME GetProp ()



result.prop = value;

return result;


In the component:

<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute type="CLASSNAME" name="var" />
    Value is = {!v.var.prop}

In the controller:

doInit : function(cmp, ev) {
        var action = cmp.get("c.GetProp");

        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                cmp.set('v.var', response.getReturnValue());
            else if (state === "ERROR") {
                alert('Error : ' + JSON.stringify(errors));

Component or App can use the controller property by using <aura:attribute/>

    <aura:attribute name="prop" type="String"/>

For more information refer Lightning Components Basics Trailhead or Component Attributes

  • 2
    In his question, he says he's asking about an APEX controller's property, which is different than the JS property in his Lightning Controller. Might be a mistatement in his question, but clearly not the same.
    – crmprogdev
    Jan 25, 2017 at 5:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .