Skip to content

Commit

Permalink
Merge pull request #57 from diablomarcus/master
Browse files Browse the repository at this point in the history
Allows global disabling of error messages in case someone wants that
  • Loading branch information
Huei Tan committed Dec 5, 2014
2 parents ff1aee1 + 18464b7 commit 8b1b46f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
12 changes: 7 additions & 5 deletions dist/angular-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,14 @@
* @returns {}
*/
var invalidFunc = function(element, validMessage, validation, callback, ctrl) {
var messageElem = element.next();
messageElem.css('display', '');
if ($validationProvider.showErrorMessage) {
messageElem.html($validationProvider.getErrorHTML(validMessage || $validationProvider.getDefaultMsg(validation).error));
var messageElem = element.next(),
messageToShow = validMessage || $validationProvider.getDefaultMsg(validation).error;

if ($validationProvider.showErrorMessage && messageToShow) {
messageElem.html($validationProvider.getErrorHTML(messageToShow));
messageElem.css('display', '');
} else {
messageElem.html('');
messageElem.css('display', 'none');
}
ctrl.$setValidity(ctrl.$name, false);
if (callback) callback();
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.

12 changes: 7 additions & 5 deletions src/directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@
* @returns {}
*/
var invalidFunc = function(element, validMessage, validation, callback, ctrl) {
var messageElem = element.next();
messageElem.css('display', '');
if ($validationProvider.showErrorMessage) {
messageElem.html($validationProvider.getErrorHTML(validMessage || $validationProvider.getDefaultMsg(validation).error));
var messageElem = element.next(),
messageToShow = validMessage || $validationProvider.getDefaultMsg(validation).error;

if ($validationProvider.showErrorMessage && messageToShow) {
messageElem.html($validationProvider.getErrorHTML(messageToShow));
messageElem.css('display', '');
} else {
messageElem.html('');
messageElem.css('display', 'none');
}
ctrl.$setValidity(ctrl.$name, false);
if (callback) callback();
Expand Down

0 comments on commit 8b1b46f

Please sign in to comment.