Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix(ngShow/ngHide, ngIf): functions with zero args should be truthy #5605

Closed
wants to merge 1 commit into from

Conversation

btford
Copy link
Contributor

@btford btford commented 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 #5414

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
@@ -20,6 +20,16 @@ describe('ngShow / ngHide', function() {
}));


// https://github.com/angular/angular.js/issues/5414
it('should show if the expression is a function with a single argument', inject(function($rootScope, $compile) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the significance of "single argument"? I don't see it used in the actual test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops! should be "zero arguments."

@ghost ghost assigned IgorMinar Jan 3, 2014
@IgorMinar
Copy link
Contributor

lgtm

@IgorMinar
Copy link
Contributor

can we get this merged for the release?

@btford
Copy link
Contributor Author

btford commented Jan 3, 2014

yes

@btford
Copy link
Contributor Author

btford commented Jan 3, 2014

Landed as 01c5be4.

@btford btford closed this Jan 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

toBoolean has inconsistent results for functions with 0 arguments and for functions with more than 0 arguments
2 participants