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

input["email"] and ngRequired are not working together anymore #7849

Closed
swisstofu opened this issue Jun 16, 2014 · 9 comments
Closed

input["email"] and ngRequired are not working together anymore #7849

swisstofu opened this issue Jun 16, 2014 · 9 comments

Comments

@swisstofu
Copy link

input["email"] and ngRequired are not working together anymore

version : 1.3.0-beta.11
browsers: chrome, safari
OS: osx mavericks

hi guys, there is a regression in 1.3.x, that you can easily reproduce.

this used to work in stable version (https://code.angularjs.org/1.2.18/docs/api/ng/input/input%5Bemail%5D)

thanks

@caitp
Copy link
Contributor

caitp commented Jun 16, 2014

thanks for the bug report, I can confirm this. would you be interested in putting together a fix?

The behaviour should be somewhat similar to native constraint validation (http://jsfiddle.net/ep4Bf/)

@swisstofu
Copy link
Author

yes, i will have a look

On Mon, Jun 16, 2014 at 5:02 PM, Caitlin Potter [email protected]
wrote:

thanks for the bug report, would you be interested in putting together a
fix?


Reply to this email directly or view it on GitHub
#7849 (comment).

@swisstofu
Copy link
Author

i would propose the following in /Users/christophe.krebser/git/angular.js/src/ng/directive/input.js, row # 1138, replace function emailInputType with :

function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
  textInputType(scope, element, attr, ctrl, $sniffer, $browser);

  var emailValidator = function(value) {
    return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);
  };

  ctrl.$validators.email = emailValidator;
}

i tested it and it worked on my project. Other validators such as url and would need to be rewritten too. Do you want me to fork and pull request ?

@caitp
Copy link
Contributor

caitp commented Jun 16, 2014

Definitely. If you need help don't hesitate to ask =)

@swisstofu
Copy link
Author

Ok thanks! well yes I would need some help, this is my first attempt to help so i'm a bit lost... i wrote a test case in test/ng/directive/inputSpec.js but I don't know how to execute it... grunt test just take ages on my side... is this something more specific to run only those tests ? thank you for your help

@Narretz
Copy link
Contributor

Narretz commented Jun 16, 2014

@swisstofu Does the test suite finish at all? You can execute specific tests with changing it to iit or describe to ddescribe (But don'T forget to change it back)

@swisstofu
Copy link
Author

@Narretz thanks for your answer. i was able to run test suite but i had to remove --head from 'version-info.js`, this doesn't seem to work on osx mavericks... don't know...

test suite wasn't completed because of other issues, but my test case works just fine so i would be ready to submit... i've created a branch but i'm not able to push it to angular repo (well that's sounds logical...).

@caitp how can I get the rights to do so ? or should I provide you with a fork ? i don't know the procedure sorry for that! thx for your help!

@Narretz
Copy link
Contributor

Narretz commented Jun 17, 2014

@swisstofu You have to fork the angular.js repo on github. Then push your branch on the forked repo (remote) and initiate a pull request. Forking / creating a pull request is only possible from the github site / api, not from shell.

@swisstofu
Copy link
Author

ok thanks @Narretz i've created the pull request here : #7868

ckknight pushed a commit to ckknight/angular.js that referenced this issue Jul 16, 2014
…/ eachother

ngRequired added to an email field wasn't working properly. ng-invalid-required
stayed true unless a valid email was entered.

correct behaviour is that it turns to ng-valid-required at first entered key.

Closes angular#7849
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants