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.

1 Answer 1

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);
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .