You need to sign in to do that
Don't have an account?
VSK98
Hi All,
I have created the Aura: Method tag, under I declared few attributes with default values. When i am trying to access the attributes with their name getting UNDEFINED values.
Aura: Method
JS Controller:
Regards,
VSK98
How to get Aura:Method Attributes in JS Controller
<aura:method name="myMethod" action="{!c.executeMyMethod}"> <aura:attribute name="Cname" type="string" default="test"/> <aura:attribute name="city" type="string" /> <aura:attribute name="Assetcnt" type="string" /> <aura:attribute name="CustomerId" type="string" /> <aura:attribute name="children" type="list" /> </aura:method>
Hi All,
I have created the Aura: Method tag, under I declared few attributes with default values. When i am trying to access the attributes with their name getting UNDEFINED values.
Aura: Method
<aura:method name="myMethod" action="{!c.executeMyMethod}"> <aura:attribute name="Cname" type="string" default="test"/> <aura:attribute name="city" type="string" /> <aura:attribute name="Assetcnt" type="string" /> <aura:attribute name="CustomerId" type="string" /> <aura:attribute name="children" type="list" /> </aura:method>
JS Controller:
executeMyMethod : function(component, event, helper) { console.log('Beforeset: '+ component.get("v.myMethod")); --- Undefined console.log('Beforeset: '+ component.get("v.Cname")); --- Undefined console.log('Beforeset: '+ component.get("v.myMethod.Cname")); --- Undefined }
Regards,
VSK98
I have tried with your code but unable to set the value into another attribute
Regards,
VSK98
you can try the following way to get the parameter list in the method description (child method) .
var params = event.getParam('arguments');
if (params) {
var Cname= params.Cname;
var city= params.city;
}
To call the method use aura id to find the child component and call the respective method with mentioned parameters as per the defination
var CDT = component.find("childcomponentName");
CDT.myMethod(Cname,city,Assetcnt,CustomerId,children);
component.myMethod(Cname,city,Assetcnt,CustomerId,children)
I can get the values to Child component from Parent Component. But unable to set the value into another attribute,
Component.set("v.Cname",param.Cname) ---- not working
Regards,
VSK98
https://rajvakati.com/2018/01/02/salesforce-aura-method/