<!DOCTYPE html>
<html>

  <head>
    <script data-require="angular.js@1.3.10" data-semver="1.3.10" src="https://code.angularjs.org/1.3.10/angular.js"></script>
    <script data-require="jquery@2.1.3" data-semver="2.1.3" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/angularjs-toaster/0.4.9/toaster.min.css" rel="stylesheet" />
    <script src="https://code.angularjs.org/1.3.10/angular-animate.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angularjs-toaster/0.4.9/toaster.min.js"></script>
    <link data-require="bootstrap@3.3.1" data-semver="3.3.1" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
    <script data-require="bootstrap@3.3.1" data-semver="3.3.1" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.10/angular-messages.min.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body ng-app="main" ng-controller="FormCtrl">
    <toaster-container></toaster-container>
    <h1>Test form</h1>
    <form name="testForm" ng-submit="ok(testForm.$valid)" novalidate="">
      <div class="modal-body">
        <div class="form-group">
          <label>first name:</label>
          <input type="text" class="form-control" ng-model="person.firstName" name="firstName" required="" />
          <div ng-if="testForm.$submitted" ng-messages="testForm.firstName.$error">
            <div ng-message="required" class="text-danger">Required!</div>
          </div>
        </div>
        <div class="form-group">
          <label>last name:</label>
          <input type="text" class="form-control" name="lastName" required ng-model="person.lastName" ng-minlength="3" ng-maxlength="10" />
          <div ng-if="testForm.$submitted" ng-messages="testForm.lastName.$error">
            <div ng-message="required" class="text-danger">Required!</div>
            <div ng-message="minlength" class="text-danger">This field must be at least 3 chars long!</div>
            <div ng-message="maxlength" class="text-danger">This field must be at most 10 chars long!</div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <div class="btn-group" role="group" aria-label="...">
          <button type="submit" class="btn btn-default btn-sm" ng-disabled="testForm.$submitted && testForm.$invalid">Ok</button>
          <button type="button" class="btn btn-default btn-sm" ng-click="cancel()">Cancel</button>
        </div>
      </div>
    </form>
  </body>

</html>
var app = angular.module('main', ['ngMessages', 'toaster']).
controller('FormCtrl', function ($scope, toaster) {
    $scope.person = {};
    $scope.ok = function (valid) {
        if (valid) {
            toaster.pop('success', "Congratulations!", "Your form is successfully submitted !");
        }
    };
});
/* Styles go here */
.ng-submitted .ng-invalid{
    border-color: #a94442;
    border-width: 2px;
    box-shadow:none;
}