<!DOCTYPE html>
<html lang="en" ng-app="app">

  <head>
    <script data-require="jquery@3.0.0" data-semver="3.0.0" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js"></script>

    <link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" />
    <script data-require="bootstrap.js@3.3.6" data-semver="3.3.6" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
    <script src="script.js"></script>
  </head>

  <body ng-controller="UserController">
    <h1>{{title}}</h1>
    <div class="container">
      <div class="row">
        <div class="col-md-12">
          <section style="width:60%; margin:30px;">
          <form novalidate="" validate-form name="form" role="form">
            <div class="form-group">
              <input type="text" class="form-control" ng-model="first_name" name="first_name" />
            </div>
            <div class="form-group">
              <input type="text" class="form-control" ng-model="last_name" name="last_name" />
            </div>
            <div class="form-group">
              <input type="text" class="form-control" ng-model="email" name="email" />
            </div>
            <div class="form-group">
              <input type="password" class="form-control" ng-model="password" name="password" />
            </div>
            <div class="form-group">
              <input type="text" class="form-control" ng-model="country" name="country" />
            </div>
            <a type="button" class="btn btn-success" ng-click="clickThings('Submit Clicked')">Submit</a>
          </form>
          </section>
        </div>
  
      </div>
    </div>
  </body>

</html>
angular.module('app',[])
  .directive('validateForm',['$compile',
            function($compile)
            {
                var addErrors = function(rules, form, ctrls, scope, config){
                    //code
                };

                
                return {
                    restrict: 'A',
                    require: ['^form'],
                    link: {
                        post: function(scope, element, attrs, ctrls){

                            var form = ctrls[0];
                            var config = scope.validator;

                            if(typeof config != 'object') return;

                            var rules = config['rules'];
                            var errors = [];

                            //-----
                        },
                        pre: function(scope, element, attrs, ctrls){

                            var elm = element.find('select, input, textarea').attr('validate-field','');
                            element.removeAttr("validate-form"); //remove the attribute to avoid indefinite loop
                            element.removeAttr("data-validate-form");
                            $compile(element.contents())(scope);
                        }
                    }
                };
            }

        ])
  .controller('UserController',['$scope', function($scope){
      $scope.title = 'Form Validator';
      $scope.clickThings = function(value){
        alert(value); //pops up twice means ng-click fires twice
      }
  }]);
/* Styles go here */