-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngList):Make ngList work with input of type email, url #4549
Conversation
Thanks for the PR!
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
ctrl.$parsers.push(function(value) { | ||
var empty = ctrl.$isEmpty(value); | ||
if (empty || NUMBER_REGEXP.test(value)) { | ||
if (empty || NUMBER_REGEXP.test(value)) { |
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.
This change doesn't seem necessary
@caitp thanks for feedback, changed this according to your comments. |
@@ -4,6 +4,16 @@ var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\ | |||
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/; | |||
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/; | |||
|
|||
function every(array, fun) { |
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.
One thing though, because this is kind of a helper, it may be suitable to add it to src/Angular.js, along with the others. Even if it's not made public, it might help prevent similar additions from being added to other source files. Once triaged I'm sure the core team will have their own things to say about all of it
Validity for inputs are checked for single value using static regexp, which won't work with ngList directive on the input, since it's getting us an array of attributes.
Thanks @caitp once again. Updated PR. |
It isn't, in fact. @mary-poppins seems not to like the commit mesage, though it's copy of my previous one, that passed the check in #4295, same for the Contributor signed CLA checkbox. |
This kinda went stale, should I update it? |
I'm really confused how this isn't in fact closed. I'd say yes, update it. |
Is there any movement on this? What's needed next to merge it in? |
…nput. It returns a string, not an array, but should be included as valid HTML and validated by Angular. angular#4549
@caitp Do you know why |
@RichardLitt The last build is failing because of jshint/jscs errors. You can see them locally if you run |
var urlValidator = function(value) { | ||
if (ctrl.$isEmpty(value) || URL_REGEXP.test(value)) { | ||
if (isArray(value)) { | ||
testedValid = every(value, function(val){return URL_REGEXP.test(val)}) |
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.
You need a semicolon after return URL_REGEXP.test(val)
@caitp Thanks a lot! Edited those, declared |
… should work the same. Added semicolon. angular#4549
when this finally lands, this will also close #4185 |
At the moment, I would suggest marking this as a known issue and just moving on to implement support for |
Validity for inputs are checked for single value using static regexp, which won't work with ngList directive on the input, since it's getting us an array of attributes.
Just like [https://github.com//pull/4295], but introducing
every
helper function, just as I mentioned at my last comment there.