From 01c5be4681e34cdc5f5c461b7a618fefe8038919 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Thu, 2 Jan 2014 14:48:03 -0800 Subject: fix(ngShow/ngHide, ngIf): functions with zero args should be truthy Previously, expressions that were a function with one or more arguments evaluated to true, but functions with zero arguments evaluated to false. This behavior seems both unintentional and undesirable. This patch makes a function truthy regardless of its number of arguments. Closes #5414 --- src/Angular.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Angular.js') diff --git a/src/Angular.js b/src/Angular.js index 386682a3..11ce5cf5 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -959,7 +959,9 @@ function fromJson(json) { function toBoolean(value) { - if (value && value.length !== 0) { + if (typeof value === 'function') { + value = true; + } else if (value && value.length !== 0) { var v = lowercase("" + value); value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]'); } else { -- cgit v1.2.3