Skip to content Skip to sidebar Skip to footer

Ng-show Not Working Even Though Condition Is Met

I am trying to use ng-show and it is simply when something exists, display it. {{comment}} I tested this in the scope comment='No' but i

Solution 1:

ng-show directive internally uses a method toBoolean

Here is how it looks like

functiontoBoolean(value) {
  if (value && value.length !== 0) {
    var v = lowercase("" + value);
    value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');
  } else {
    value = false;
  }
  return value;
}

If you look at the implementation, anything like no, false,n,0 evaluate to false.

Post a Comment for "Ng-show Not Working Even Though Condition Is Met"