search

Home  >  Q&A  >  body text

angular.js - 登录输入判断

大家好,我遇到一个问题,在登录的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
            }
        }
仅有的幸福仅有的幸福2744 days ago520

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-15 16:57:37

    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.

    reply
    0
  • Cancelreply