0

I have the following attribute in my lightning component

<aura:attribute name="serverList" type="Opleiding__c[]"/>

I can call this in my javascript controller with

var serverList = component.get("v.serverList");

I want to be able to pass its value to my javascript helper

I tried in my helper

({
selectedTrue : function(serverList) {..}
})

or

    ({
        selectedTrue : function(serverList){
var serverList = component.get("v.serverList");}
    })

Both do not work, am i missing something?

2
  • What you've written should work; what problem are you experiencing? An error? An exception?
    – sfdcfox
    Mar 24, 2018 at 10:11
  • @sfdcfox Everything in the code after this line does not work anymore
    – Thomas
    Mar 24, 2018 at 10:14

1 Answer 1

1
<aura:attribute name="serverList" type="Opleiding__c[]"/>

Your component controller should look like:

someFunction: function(component, event, helper) {
    helper.helperMethod(component, component.get("v.serverList") );
}

Your component helper should look like:

helperMethod : function(component, Servers) {
    console.log('Server List********', Servers);
}

I have the same logic working but i pass accounts from component to helper like above. You were missing component in below statement

({
    selectedTrue : function(serverList) {
        var serverList = component.get("v.serverList");
    }
})

Hope the solution helps!!

0

You must log in to answer this question.

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