This repository was 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.4k
$isEmpty
fixes
#10164
Merged
petebacondarwin
merged 4 commits into
angular:master
from
petebacondarwin:$isEmpty-fixes
Nov 23, 2014
Merged
$isEmpty
fixes
#10164
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4644c58
revert: fix(input): always pass in the model value to `ctrl.$isEmpty`
petebacondarwin 40406e2
fix(input[date]): do not use `$isEmpty` to check the model validity
petebacondarwin 8692f87
fix(input): set ngTrueValue on required checkbox
Narretz 42d09f1
docs(NgModelController): clarify the value parameter for $isEmpty
petebacondarwin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand why there is this modelValue || viewValue condition. If you are saying, hey take the modelValue and if that isn't there, take the viewValue why not always take the modelValue? Text-based input types by default do not change their type when parsed, so we should be good checking the modeValue. Unless someone messes with parsers / formatters, I don't think there's a case where we have a viewValue, but not a modelValue in the validator.
Conundrum is obviously that we say isEmpty should only be for the viewValue, so passing modelValue to it is fishy.
So what about always passing the viewValue to $isEmpty, regardless of modelValue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again this is part of the revert of Tobias's commit.
It doesn't actually have anything to do with
$isEmpty
.I am not sure of the reasoning behind checking both values. It would seem to me that we should be checking the
$viewValue
only as you say, since this is what the input[url] directive has control over. You can't assume anything about the model, since users can add in their own crazy parsers via their own directives if they want.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't see your reverted the commit.