Angular Validate

HTML

<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.min.js"></script>
<script src="https://rawgit.com/jpkleemans/angular-validate/master/dist/angular-validate.min.js"></script>
<div ng-app="app" ng-controller="TestController">
  <form name="registerform" ng-validate="validationOptions">
    Email: <input type="email" name="email"><br>
    Password: <input type="password" name="password">
  </form>

  <br>

  <button ng-click="register()">validate</button>
</div>

JavaScript

var app = angular.module('app', ['ngValidate']);

app.controller('TestController', function($scope) {
  $scope.validationOptions = {
    rules: {
      email: {
        required: true,
        email: true
      },
      password: {
        required: true,
        minlength: 6
      }
    },
    messages: {
      email: {
        required: "We need your email address to contact you",
        email: "Your email address must be in the format of name@domain.com"
      },
      password: {
        required: "You must enter a password",
        minlength: "Your password must have a minimum length of 6 characters"
      }
    }
  };

  $scope.register = function() {
    if ($scope.registerform.validate()) {
      alert('valid!');
    }
  }
});