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

$isEmpty fixes #10164

Merged
merged 4 commits into from
Nov 23, 2014
Merged

$isEmpty fixes #10164

merged 4 commits into from
Nov 23, 2014

Conversation

petebacondarwin
Copy link
Contributor

We should only use $isEmpty on $viewValue not for validating models.

@googlebot
Copy link

CLAs look good, thanks!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@@ -1812,7 +1816,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
* default. The `checkboxInputType` directive does this because in its case a value of `false`
* implies empty.
*
* @param {*} value Model value to check.
* @param {*} value Reference to check.
Copy link
Contributor

Choose a reason for hiding this comment

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

Reference is a little too vague for my taste, especially since it should always be the $viewValue that is checked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, that was just the straight revert of Tobias's commit

@petebacondarwin
Copy link
Contributor Author

So if I fix up the Reference comment in a docs commit, can we merge this and then have a separate discussion/PR about the semantics of the input[url] validation?

@Narretz
Copy link
Contributor

Narretz commented Nov 22, 2014

Yes, LGTM.

petebacondarwin and others added 4 commits November 23, 2014 15:08
This commit tried to create consistency by ensuring that `$isEmpty` is not
called on both model and view values but it chose to only use `$modelValue`,
which is not actually correct.

`$isEmpty` is designed to compute whether the `$viewValue` is empty. In
practice this is the only part of the parse/format system that the
directive has control over. We can't rely on the `$modelValue` being in
any particular format since other directives can add in their own formatters
and parsers to completely change this.

(reverted from commit 3e51b84)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants