Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit cf4eeb0

Browse files
author
Kent C. Dodds
committed
Merge pull request #38 from m0t0r/fix-multicheckbox-issue
fix(multiCheckbox): Set 'required' validation only when desired. Clos…
2 parents 000504a + a5cd6f9 commit cf4eeb0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/types/multiCheckbox.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ export default ngModule => {
5151
}, true);
5252

5353
function checkValidity(expressionValue) {
54-
var valid = angular.isArray($scope.model[opts.key]) &&
55-
$scope.model[opts.key].length > 0 &&
56-
expressionValue;
54+
var valid;
5755

58-
$scope.fc.$setValidity('required', valid);
56+
if ($scope.to.required) {
57+
valid = angular.isArray($scope.model[opts.key]) &&
58+
$scope.model[opts.key].length > 0 &&
59+
expressionValue;
60+
61+
$scope.fc.$setValidity('required', valid);
62+
}
5963
}
6064

6165
function setModel() {

0 commit comments

Comments
 (0)