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

lightning component attribute is not set
Hi
I am using the below code to set the component attribute in the init event. The server controller is returning the values, which I am assigning to the component attribute. But the value is not getting set. Can you please help.

Thanks
Vinodh.
I am using the below code to set the component attribute in the init event. The server controller is returning the values, which I am assigning to the component attribute. But the value is not getting set. Can you please help.
({ doInit:function(component,event,helper){ console.log('start of init method'); var options = component.get("v.options"); options.push({'label':'Pleasure Boat','value':'PB'}); var action = component.get("c.getBoatType"); action.setCallback(this,function(response){ var state = response.getState(); if(state == "SUCCESS") { var resp = response.getReturnValue(); console.log("length of array " + resp.length); component.set("v.boatType",resp); var bt = component.get("v.boattype"); console.log('BT ' + bt.length); } else { console.log("Failed with state " + state); } }); $A.enqueueAction(action); } })
Thanks
Vinodh.
component.set("v.boatType",resp);