You need to sign in to do that
Don't have an account?
Alex Dinu 17
Set an attribute value in helper
I'm trying to code a pure function, passing in the component into the helper method and setting:
In the component, I have the following defined:
But it does not update the value.
Thanks
In the component, I have the following defined:
<aura:attribute name="teamCount" type="integer" default="1"/>in the controller, I'm trying to do the following:
helper.onSetTeamCountRequest( component.get("v.teamCount"));And in the helper, I want to change the value:
onSetTeamCountRequest: function( teamCountAttribute) { teamCountAttribute = 5; },
But it does not update the value.
Thanks
http://documentation.auraframework.org/auradocs#reference?topic=api:Component
You can only use Component as parameter here with get / set functions as you already done.
I have had the same apprehension at first but I built big components passing always components and Inever had a problem of memory.
component.get("v.teamCount") just returns the value "5" (not the reference to the component itself attribute which doesn't have an accessible attribute "value" either but just a default value).
There are three kind of attribute: Function, Object and Basic.
If you get an object and change a value of an attribute, you always need a component.set('v.myObject', myModifiedObject); at the end, if you want to see the change on your form.
All Answers
Alex
http://documentation.auraframework.org/auradocs#reference?topic=api:Component
You can only use Component as parameter here with get / set functions as you already done.
I have had the same apprehension at first but I built big components passing always components and Inever had a problem of memory.
component.get("v.teamCount") just returns the value "5" (not the reference to the component itself attribute which doesn't have an accessible attribute "value" either but just a default value).
There are three kind of attribute: Function, Object and Basic.
If you get an object and change a value of an attribute, you always need a component.set('v.myObject', myModifiedObject); at the end, if you want to see the change on your form.