-
Notifications
You must be signed in to change notification settings - Fork 27.5k
False boolean values found when using ng-show/ng-hide #3436
Comments
I agree. The docs clearly say :"When the ngShow expression evaluates to false then the ng-hide CSS class is added to the class attribute on the element causing it to become hidden." There is no way that one would expect a string in some cases evaluates to true and in other cases to false. |
+1 I'd expect a string value to evaluate to true. The current behavior is very confusing and should be fixed or at least mentioned in the docs. |
It's rather non-standard behavior which could very easily cause bugs, so unless there's some actual reason for this, +1 for fix. |
The documentation fix should inform users of this behaviour, however I think the |
This issue has been a focus of problems for some users and we discussed it on the IRC that it should be at least documented. ~Amended the style to use bootstrap notes, I think overall it looks better and catches the eyes more easily. However there are no anchor links to these, if these are necessary they can be added later. Closes angular#3436 Closes angular#5762
This issue has been a focus of problems for some users and we discussed it on the IRC that it should be at least documented. ~Amended the style to use bootstrap notes, I think overall it looks better and catches the eyes more easily. However there are no anchor links to these, if these are necessary they can be added later. Closes angular#3436 Closes angular#5762
Oh.. this kind of magic is just pure evil.. Why would anyone do such a weird thing and introduce this kind of typecasting? function toBoolean(value) {
return Boolean(value);
} Would bring an expected behaviour. |
This issue should be reopened. As @bytasv has mentioned this is pure evil. This is clearly a bug, moreover it's a a bug that is very difficult to catch! Mentioning it in the docs is not a solution. |
Dudes, calm down! I am in perfect agreement that it's not the right thing to do. Maybe some day we can remove PRs welcome, IMO. |
…her one is entered alone. After the second letter has been entered, the results will be returned. Reason: 'f' will be interpreted as false and 'n' as null, which are both falsy. Further reference: http://stackoverflow.com/questions/18177522/why-ng-show-doesnt-work-when-f-or-n-is-typed angular/angular.js#1229 angular/angular.js#3436
Re-opening this ticket from a year ago. This is clearly a bug in Angular, and should not have been closed.
If you type 'n', 'no', 'f', 'false' or '0' into the search field, ng-hide / ng-show is triggered incorrectly.
Here is an updated plunker illustrating the issue:
http://plnkr.co/U99tFB
Original ticket:
#1229
The text was updated successfully, but these errors were encountered: