Skip to content

Commit 4c42b0a

Browse files
committed
Adding error key classes to the .form-group as well to distinguish between different errors.
1 parent 67931ce commit 4c42b0a

File tree

6 files changed

+106
-56
lines changed

6 files changed

+106
-56
lines changed

bower.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"**/.*",
1616
"node_modules",
1717
"bower_components",
18+
"test-app",
1819
"src"
1920
],
2021
"repository": {

dist/bootstrap-angular-validation-all.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bootstrap-angular-validation-core.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/directives/validation.directive.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ angular.module('bootstrap.angular.validation').directive('bsValidation', [
4040
var validationMessageService = validationService.getValidationMessageService(displayErrorAs);
4141

4242
// Register generic custom validators if added to element
43-
angular.forEach(validationService.getValidators(), function(key) {
43+
angular.forEach(validationService.getValidators(), function(validator) {
44+
var key = validator.name;
4445
var attrValue = $element.attr(key);
4546
if ($attr[key] || (angular.isDefined(attrValue) && attrValue !== false)) {
46-
validationService.addValidator($scope, $element, $attr, ngModelController, key);
47+
validationService.addValidator($scope, $element, $attr, ngModelController, validator);
4748
}
4849
});
4950

@@ -78,6 +79,8 @@ angular.module('bootstrap.angular.validation').directive('bsValidation', [
7879
}
7980

8081
function displayOrHideValidationState() {
82+
validationService.toggleErrorKeyClasses($formGroupElement, ngModelController.$error);
83+
8184
if (!displayValidationState) {
8285
hideSuccess();
8386
return hideError();

0 commit comments

Comments
 (0)