0

I am getting the following error Unexpected block statement surrounding arrow body when I run this code.

scope.$watch(() => {
            return ngModel.$viewValue;
          }, val => {
            if (ngModel.$isEmpty(val) && ngModel.$dirty) {
              scope.clearInputValue();
              // Remove validation errors
              ngModel.$setValidity('maxnum', true);
              ngModel.$setValidity('minnum', true);
              ngModel.$setValidity('maxsize', true);
              ngModel.$setValidity('minsize', true);
              ngModel.$setValidity('accept', true);
            }
          });
Nikhil
  • 544
  • 1
  • 6
  • 19

1 Answers1

1

A block statement isn't needed in your first function. It is a single expression. If you remove the block statement it should get rid of the warning:

scope.$watch(() => ngModel.$viewValue, val => {
            if (ngModel.$isEmpty(val) && ngModel.$dirty) {
              scope.clearInputValue();
              // Remove validation errors
              ngModel.$setValidity('maxnum', true);
              ngModel.$setValidity('minnum', true);
              ngModel.$setValidity('maxsize', true);
              ngModel.$setValidity('minsize', true);
              ngModel.$setValidity('accept', true);
            }
          });
JoshG
  • 6,472
  • 2
  • 38
  • 61