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;

                }

            }
        }
原文地址:https://www.cnblogs.com/linm/p/12167368.html