Skip to content

Commit

Permalink
updated dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Trazzi committed Dec 11, 2015
1 parent 67ca534 commit a1a80fc
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
42 changes: 35 additions & 7 deletions dist/angular-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
angular.module('validation.provider', []);
angular.module('validation.directive', ['validation.provider']);
}).call(this);


(function() {
angular
.module('validation.provider')
Expand Down Expand Up @@ -35,6 +35,12 @@
*/
var expression = {};

/**
* default valid method
* @type {{}}
*/
var validMethod = null;

/**
* default error, success message
* @type {{}}
Expand Down Expand Up @@ -79,6 +85,23 @@
return defaultMsg[msg];
};

/**
* allow user to set the global valid method
* @param v
* @returns {*}
*/
this.setValidMethod = function(v) {
validMethod = v;
};

/**
* Get the valid method
* @returns {*}
*/
this.getValidMethod = function() {
return validMethod;
};

/**
* Override the errorHTML function
* @param func
Expand Down Expand Up @@ -247,6 +270,8 @@
this.$get = ['$injector', function($injector) {
setup($injector);
return {
setValidMethod: this.setValidMethod,
getValidMethod: this.getValidMethod,
setErrorHTML: this.setErrorHTML,
getErrorHTML: this.getErrorHTML,
setSuccessHTML: this.setSuccessHTML,
Expand All @@ -266,7 +291,7 @@
}];
}
}).call(this);


(function() {
angular
.module('validation.directive')
Expand All @@ -290,7 +315,7 @@
}
Reset.$inject = ['$injector'];
}).call(this);


(function() {
angular
.module('validation.directive')
Expand Down Expand Up @@ -321,7 +346,7 @@
}
Submit.$inject = ['$injector'];
}).call(this);


(function() {
angular
.module('validation.directive')
Expand Down Expand Up @@ -556,6 +581,9 @@
* Check validator
*/


var validMethod = (angular.isUndefined(attrs.validMethod)) ? $validationProvider.getValidMethod() : attrs.validMethod;

/**
* Click submit form, check the validity when submit
*/
Expand All @@ -565,7 +593,7 @@

isValid = checkValidation(scope, element, attrs, ctrl, validation, value);

if (attrs.validMethod === 'submit') {
if (validMethod === 'submit') {
// clear previous scope.$watch
watch();
watch = scope.$watch(function() {
Expand Down Expand Up @@ -606,7 +634,7 @@
/**
* Validate blur method
*/
if (attrs.validMethod === 'blur') {
if (validMethod === 'blur') {
element.bind('blur', function() {
var value = scope.$eval(attrs.ngModel);
scope.$apply(function() {
Expand All @@ -620,7 +648,7 @@
/**
* Validate submit & submit-only method
*/
if (attrs.validMethod === 'submit' || attrs.validMethod === 'submit-only') {
if (validMethod === 'submit' || validMethod === 'submit-only') {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/angular-validation.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a1a80fc

Please sign in to comment.