[英]eslint error: Unexpected block statement surrounding arrow body
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);
}
});
A block statement isn't needed in your first function. 您的第一个函数不需要使用block语句。 It is a single expression.
它是一个表达式。 If you remove the block statement it should get rid of the warning:
如果删除block语句,它应该摆脱警告:
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);
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.