This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
toBoolean has inconsistent results for functions with 0 arguments and for functions with more than 0 arguments #5414
Comments
Closed
ghost
assigned vojtajina
Dec 21, 2013
lgalfaso
added a commit
to lgalfaso/angular.js
that referenced
this issue
Dec 30, 2013
Make ngShow and ngHide follow javascript `truthy`/`falsy` logic and not the custom toBoolean logic Fixes angular#5414 angular#4277
lgalfaso
added a commit
to lgalfaso/angular.js
that referenced
this issue
Dec 30, 2013
Make ngShow and ngHide follow javascript `truthy`/`falsy` logic and not the custom toBoolean logic Fixes angular#5414 angular#4277 BREAKING CHANGE: The expressions * `<div ng-hide="[]">X</div>` * `<div ng-hide="'f'">X</div>` * `<div ng-hide="'[]'">X</div>` used to be evaluated to `false` and the elements were hidden. The same effect is present for `ng-show` and the elements are now visible
lgalfaso
added a commit
to lgalfaso/angular.js
that referenced
this issue
Dec 30, 2013
Make ngShow and ngHide follow javascript `truthy`/`falsy` logic and not the custom toBoolean logic Fixes angular#5414 angular#4277 BREAKING CHANGE: The expressions * `<div ng-hide="[]">X</div>` * `<div ng-hide="'f'">X</div>` * `<div ng-hide="'[]'">X</div>` used to be evaluated to `false` and the elements were hidden. The same effect is present for `ng-show` and the elements are now visible If you were previously doing `ng-show="exp"` where `$scope.exp = 'no' // (or 'n' or 'f')`, then instead write `ng-show="exp && exp !== 'no'` (or 'n' or 'f').
ghost
assigned btford
Dec 30, 2013
I like the changes suggested by @lgalfaso, but I think they only make sense in a I'm working on a fix here: https://github.com/btford/angular.js/tree/gh-5414 |
btford
added a commit
to btford/angular.js
that referenced
this issue
Jan 2, 2014
Previously, expressions that were a function with one or more arguments evaluated to true, but functions with zero arguments evaluated to false. Closes angular#5414
btford
added a commit
to btford/angular.js
that referenced
this issue
Jan 2, 2014
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 angular#5414
jamesdaily
pushed a commit
to jamesdaily/angular.js
that referenced
this issue
Jan 27, 2014
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 angular#5414
jamesdaily
pushed a commit
to jamesdaily/angular.js
that referenced
this issue
Jan 27, 2014
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 angular#5414
lgalfaso
added a commit
to lgalfaso/angular.js
that referenced
this issue
Feb 5, 2014
Make ngShow and ngHide follow javascript `truthy`/`falsy` logic and not the custom toBoolean logic Fixes angular#5414 angular#4277 angular#3969 BREAKING CHANGE: The expressions * `<div ng-hide="[]">X</div>` * `<div ng-hide="'f'">X</div>` * `<div ng-hide="'[]'">X</div>` used to be evaluated to `false` and the elements were hidden. The same effect is present for `ng-show` and the elements are now visible; and with `ng-if` and the elements are now removed If you were previously doing `ng-show="exp"` where `$scope.exp = 'no' // (or 'n' or 'f')`, then instead write `ng-show="exp && exp !== 'no'` (or 'n' or 'f').
lgalfaso
added a commit
to lgalfaso/angular.js
that referenced
this issue
Feb 5, 2014
Make ngIf, ngShow and ngHide follow javascript `truthy`/`falsy` logic and not the custom toBoolean logic Fixes angular#5414 angular#4277 angular#3969 BREAKING CHANGE: The expressions * `<div ng-hide="[]">X</div>` * `<div ng-hide="'f'">X</div>` * `<div ng-hide="'[]'">X</div>` used to be evaluated to `false` and the elements were hidden. The same effect is present for `ng-show` and the elements are now visible; and with `ng-if` and the elements are now removed If you were previously doing `ng-show="exp"` where `$scope.exp = 'no' // (or 'n' or 'f')`, then instead write `ng-show="exp && exp !== 'no'` (or 'n' or 'f').
lgalfaso
added a commit
to lgalfaso/angular.js
that referenced
this issue
Jun 5, 2014
Make ngIf, ngShow and ngHide follow javascript `truthy`/`falsy` logic and not the custom toBoolean logic Fixes angular#5414 angular#4277 angular#3969 BREAKING CHANGE: The expressions * `<div ng-hide="[]">X</div>` * `<div ng-hide="'f'">X</div>` * `<div ng-hide="'[]'">X</div>` used to be evaluated to `false` and the elements were hidden. The same effect is present for `ng-show` and the elements are now visible; and with `ng-if` and the elements are now removed If you were previously doing `ng-show="exp"` where `$scope.exp = 'no' // (or 'n' or 'f')`, then instead write `ng-show="exp && exp !== 'no'` (or 'n' or 'f').
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have a plnkr demonstrating the issue here:
http://plnkr.co/edit/MeivE2RRsRFKF3n05vwX?p=preview
To boolean should return consistent results for any function, no matter how many arguments it has.
The text was updated successfully, but these errors were encountered: