ng之邮箱校验

$scope.sendMail = function () {

            // console.log($scope.inputValue.inputEmail);

            //校验邮箱格式是否正确

            if (!$scope.inputValue.inputEmail) {

                alert({ type: '', title: '温馨提示', msg: '请输入您的邮箱地址' });

                return;

            } else {

                var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; //正则表达式

                if (!reg.test($scope.inputValue.inputEmail)) {

                    alert({ title: '温馨提示', msg: '邮箱格式有误,请检查' });

                    return false;

                }

            }
        }
posted @ 2020-01-08 16:29  一只小菜鸟呀!  阅读(271)  评论(0编辑  收藏  举报