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

Commit 957bf72

Browse files
author
Kent C. Dodds
committed
formatting
1 parent c41b4bb commit 957bf72

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/types/multiCheckbox.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default ngModule => {
1616
},
1717
defaultOptions: {
1818
noFormControl: false,
19-
ngModelAttrs:{
19+
ngModelAttrs: {
2020
required: {
2121
attribute: '',
2222
bound: ''
@@ -36,11 +36,11 @@ export default ngModule => {
3636
$scope.$watch('model', function modelWatcher(newModelValue) {
3737
var modelValue, valueProp;
3838

39-
if(Object.keys(newModelValue).length) {
39+
if (Object.keys(newModelValue).length) {
4040
modelValue = newModelValue[opts.key];
4141

4242
$scope.$watch('to.options', function optionsWatcher(newOptionsValues) {
43-
if(newOptionsValues && Array.isArray(newOptionsValues) && Array.isArray(modelValue)) {
43+
if (newOptionsValues && Array.isArray(newOptionsValues) && Array.isArray(modelValue)) {
4444
valueProp = to.valueProp || 'value';
4545
for (var index = 0; index < newOptionsValues.length; index++) {
4646
$scope.multiCheckbox.checked[index] = modelValue.indexOf(newOptionsValues[index][valueProp]) !== -1;
@@ -50,7 +50,7 @@ export default ngModule => {
5050
}
5151
}, true);
5252

53-
function checkValidity(expressionValue){
53+
function checkValidity(expressionValue) {
5454
var valid = angular.isArray($scope.model[opts.key]) &&
5555
$scope.model[opts.key].length > 0 &&
5656
expressionValue;
@@ -71,15 +71,17 @@ export default ngModule => {
7171
checkValidity(true);
7272
}
7373

74-
if(opts.expressionProperties && opts.expressionProperties.required){
75-
$scope.$watch($scope.options.expressionProperties.required, function(newValue){
74+
if (opts.expressionProperties && opts.expressionProperties.required) {
75+
$scope.$watch($scope.options.expressionProperties.required, function(newValue) {
7676
checkValidity(newValue);
7777
});
7878
}
7979

80-
if($scope.to.required){
81-
var unwatchFormControl = $scope.$watch('fc', function(newValue){
82-
if(!newValue){ return; }
80+
if ($scope.to.required) {
81+
var unwatchFormControl = $scope.$watch('fc', function(newValue) {
82+
if (!newValue) {
83+
return;
84+
}
8385
checkValidity(true);
8486
unwatchFormControl;
8587
});

0 commit comments

Comments
 (0)