大家好,我遇到一个问题,在登录的module里面,我设置了一个属性Name,检查是否为空,可以这样写吗
<p> ng-model="loginBean.Name"</p>
if ($scope.loginBean.mode === 'Account') {
if (!$scope.loginBean.Name || !$.trim($scope.loginBean.Name).length) {
updateFormError('NameRequire');//根据返回的错误代码,打印错误
return false;//name 输入为空,false
}
}
1. If your username is special, such as email, phone number, etc., it is recommended to use regular expressions.
2. If your username only considers the length, this is OK. By the way, let’s also judge the maximum length.