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

Allows global disabling of error messages in case someone wants that #57

Merged
merged 2 commits into from
Dec 5, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions dist/angular-validation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
angular.module('validation', ['validation.provider', 'validation.directive']);
}).call(this);

Copy link
Owner

Choose a reason for hiding this comment

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

@diablomarcus

would you mind remove this diff and give me again the PR

and thanks for the work! 🍻

Copy link
Author

Choose a reason for hiding this comment

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

Done! Sorry about that. I hate having to use Windows and I forget about stuff like this.

(function() {
angular.module('validation.provider', [])
.provider('$validation', function() {
Expand Down 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