Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add equality rule #297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add equality rule #297

wants to merge 1 commit into from

Conversation

lambirou
Copy link

<input type="password" name="password" ng-model="form.password" validator="required">
<input type="password" name="password_confirm" ng-model="form.password_confirm" validator="equality=password">

equality=password

  • password is first input attribut name.

<input type="password" name="password" ng-model="form.password" validator="required">
<input type="password" name="password_confirm" ng-model="form.password_confirm" validator="equality=password">

/** equality=password
* 
* password is first input attribut name.
Copy link
Owner

@hueitan hueitan left a comment

Choose a reason for hiding this comment

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

Thanks ! do you mind also update the document https://github.com/hueitan/angular-validation#built-in-validation-in-angular-validation-rule then I will merge this pr, thanks again!

@hueitan hueitan mentioned this pull request Sep 4, 2017
@hueitan
Copy link
Owner

hueitan commented Sep 11, 2017

ping @lambirou

@@ -14,6 +14,10 @@
},
maxlength: function(value, scope, element, attrs, param) {
return !value || value.length <= param;
},
equality: function (value, scope, element, attrs, param) {
var paramVal = document.querySelector('input[name=' + param + ']').value
Copy link
Owner

Choose a reason for hiding this comment

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

You should be able to use attrs[ param ] instead of globally selector from document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants