1

I have an attribute declared in component.

<aura:attribute name="ifTrue" type="Boolean" default="False" description="Boolean  show records." />

I am setting the value to it from a function in helper.js

component.set('v.ifTrue', searchItem.includes('FTP'));

Now I'm trying to access the value from component. I alreday set value to true and am expecting to see "True" when I use console.log in helper in other function.

 console.log('ifTrue Value>>:'+{!ifTrue});

It gives me format issues while debugging. I tried other formats like {!V.ifTrue}, "{!v.ifTrue}", ifTrue etc. But I get errors.

What is the correct format to access attribute on helper. When I use "{!v.ifTrue}" similar to in component.set();, it gives me the string {!v.ifTrue} in debug.

3

You need to get the value like so

console.log('v.ifTrue' + component.get("v.ifTrue"));

Or more verbose

var trueValue = component.get("v.ifTrue");
console.log("v.ifTrue " + trueValue);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.