There are couple ways of parsing values around in lightning components.
- Storing as an attribute.
Eg. You can assign the variable value to an attribute in the component and access it from another method. This can be implemented in your helper as well as in your controller.
Eg.
Component,
<aura:attribute name="tempId" type="String"/>
Controller/Helper
foo : function(component, event, helper) {
var newId = 'xxxxxxxxx';
component.set("v.tempId", newId);
},
bar: function(component, event, helper) {
console.log(component.get("v.tempId));
}
- Passing as a parameter to a method.
This can be done within your helper only.
foo : function(component, helper) {
var newId = 'xxxxxxxxx';
helper.bar(component, newId);
},
bar: function(component, tempId) {
console.log(tempId);
}