function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sheila srivatsavsheila srivatsav 

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

 
Best Answer chosen by sheila srivatsav
PINKY REGHUPINKY REGHU
haiii,
    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

Arun pattnaik 17Arun pattnaik 17
Hi,

you can make use of component.get("c.claimType"); in your aura controller .(try it in doinit)
PINKY REGHUPINKY REGHU
haiii,
    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
 
This was selected as the best answer
Deepali KulshresthaDeepali Kulshrestha
Hi Sheila,

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