You need to sign in to do that
Don't have an account?
Ramakrishna Reddy Gouni
what logical operator should work in lightning
What logical operator should work in lightning conditions
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Greetings to you!
These Logical Operators will work in Lightning components:
1. &&
Returns true if both operands are individually true.
If you have more than two arguments, you can chain multiple && operations.
This syntax is awkward in markup so we recommend the alternative of using the and()function when you have two arguments. For example, and(isEnabled, hasPermission). The and() function only works with two arguments.
2. ||
Returns true if either operand is individually true.
If you have more than two arguments, you can chain multiple || operations.
You can alternatively use the or() function when you have only two arguments. The or() function only works with two arguments.
3. !
Unary operator. Returns true if the operand is false. This operator should not be confused with the ! delimiter used to start an expression in {!. You can combine the expression delimiter with this negation operator to return the logical negation of a value, for example, {!!true} returns false.
Note: Instead of && you have to use &&
Please refer to the below links which might help you further.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/expr_operators.htm
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/expr_functions.htm
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Following operators can be used in Lightning:
1.Arithmetic Operators
2.Numeric Literals
3.String Operators
4.String Literals
5.Comparison Operators
6.Logical Operators
7.Logical Literals
8.Conditional Operator
Please refer the below link for more information:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/expr_operators.htm
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
Are you facing this issue inside aura:if? If yes, then please note that you have only 2 conditions inside an aura:if. There are workarounds available if you want to calculate more than 2 conditions.