0

I am facing issue with the angular js 1.x not updating the visibility of the element even when variable values are detected. I am using custom angular open-close symbols but I don't see this as an issue.

Here's the sample code:

<li ng-if=(( fnc_show_lockin_period_clause() ))></li>

where fnc_show_lockin_period_clause() is a function in my angular controller.

When the function returns true, the updated html looks like:

<li ng-if="true">some content here...</li>

and, when the function returns false, the updated html looks like:

<li ng-if="false">some content here...</li>

Even when the directive is able to identify the value of the variable, it is failing to update the visibility. Exact same thing is happening with the use of ng-show.

Looking for some help.

The Coder
  • 121
  • 1
  • 7

1 Answers1

0

It is likely that the function is returning the string "false" instead of the boolean false.

Convert it to a boolean.

If the value is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (""), the expression is false. All other values, including any object or the string "false", evaluate as true.

georgeawg
  • 48,608
  • 13
  • 72
  • 95