Given two controller methods defined for a Lightning component as follows, how can I call bar()
from foo()
? If I try it using the code shown below, I get the error, "bar is not defined".
({
bar : function(component, event, helper) {
console.log('bar just happened');
},
foo : function(component, event, helper) {
// I would love for this to work,
// but it doesn't work as expected.
bar(component, event, helper);
// I've also tried this but get a slightly
// different but equally discouraging error.
this.bar(component, event, helper);
}
})