Sunday, 30 April 2017

Nodejs validation of email with ng-pattern

With ng-pattern of email in gui part need to be validated with mysql database using nodejs.

email.html

`

 <input type="email" class="form-control" placeholder="john@in.ibm.com" 
                ng-model="signup.email" name="email"   ng-pattern = "/^[^<>()
                [\]\\,;:\%#^\s@\"$&!@]+@(([in]+\.)([ibm]+\.)([com]+))$/" required>
   <span ng-show="signupform.$error.pattern && signupform.email.$invalid && 
         !signupform.email.$untouched" class="small helpblock">Enter a valid email.</span>`

Above pattern can be validated at server side nodejs ??

Controller.js

   $scope.submitForm = function(isValid) {
        $scope.submitted = true;
        if ( isValid && $scope.signup.password == $scope.signup.confirm ) {
            service.signUp({
                data: {
                    user: $scope.signup
                }
            }).then(function(response) {
                if (response.status == "success") {
                    Notification.success('Successfully Signed Up');
                } else {
                    Notification.error('Error Sign Up');
                }
            })
        }
    }



via ramya

No comments:

Post a Comment