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

how to get the value of aura:attribute in controller.js
In my lightning component I am having like this.
<aura:attribute name="claimType" type="String" default="Pharmacy" description="some pharamcy"/>
I want the default value of the attribute in the controller.js file of the component for further processing.
Please tell me how to do this.
thanks
sheila
<aura:attribute name="claimType" type="String" default="Pharmacy" description="some pharamcy"/>
I want the default value of the attribute in the controller.js file of the component for further processing.
Please tell me how to do this.
thanks
sheila
component.get(String key) retrieves and assigns values associated with the specified key on the component. Keys are passed in as an expression, which represents an attribute value.In this case ,
var i=component.get("v.claimType");
thanks
All Answers
you can make use of component.get("c.claimType"); in your aura controller .(try it in doinit)
component.get(String key) retrieves and assigns values associated with the specified key on the component. Keys are passed in as an expression, which represents an attribute value.In this case ,
var i=component.get("v.claimType");
thanks
Have a look at the code below:
<aura:component>
<aura:attribute name="buttonLabel" type="String"/>
</aura:component>
To get the attribute value in your controller.js use the statement
var label = component.get("v.buttonLabel");
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha