<!DOCTYPE html>
<html>

  <head>
    <!-- CSS -->
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
    <style>
        body     { padding-top:30px; }
    </style>
    <!-- JS -->
    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="http://code.angularjs.org/1.2.22/angular.js"></script>
    <script src="app.js"></script>
  </head>

  <body ng-app="ngApp" ng-controller="mainController">
    <button ng-click="play()">Click</button>
    <audio style="display: none;" pk-audio="sounds.sound" controls="" src="http://www.flashkit.com/imagesvr_ce/flashkit/soundfx/Interfaces/Blips/Lift_Me_-Vyachesl-8596/Lift_Me_-Vyachesl-8596_hifi.mp3"></audio>
  </body>

</html>
// create angular app
var ngApp = angular.module('ngApp', []);

ngApp.directive('pkAudio', function () {
    return {
        restrict: 'A',
        scope: {
            pkAudio: '='
        },
        link: function (scope, element, attrs, ngModelCtrl) {

            var removeBehaviorsRestrictions = function() {
                element.load();
                window.removeEventListener('keydown', removeBehaviorsRestrictions);
                window.removeEventListener('mousedown', removeBehaviorsRestrictions);
                window.removeEventListener('touchstart', removeBehaviorsRestrictions);
            };
            window.addEventListener('keydown', removeBehaviorsRestrictions);
            window.addEventListener('mousedown', removeBehaviorsRestrictions);
            window.addEventListener('touchstart', removeBehaviorsRestrictions);

            scope.pkAudio = element[0];
        }
    };
});

// create angular controller
ngApp.controller('mainController',['$scope', '$interval',  function($scope, $interval) {
  $scope.sounds = {};
  
  $scope.play = function(){
  };
  
  $interval(function(){
    $scope.sounds.sound.play();
  },1500);

}]);
# AngularJS Form Validation

This is the demo to go along with the [scotch.io](http://scotch.io) tutorial: [AngularJS Form Validation](http://scotch.io/tutorials/javascript/angularjs-form-validation).

## Demonstration of:

- Form Properties ($valid, $invalid, $pristine, $dirty)
- Showing Errors (ngShow)
- Conditional Classes (ngClass)
- Disabled Form (ngDisabled)
- Custom Validation (ngMinlength and ngMaxlength)