(function() {
    'use strict';

    angular
        .module('app')
        .directive('timerClock', timerClock);

    timerClock.$inject = ['$window', '$timeout'];
    
    function timerClock ($window, $timeout) {
       
        var directive = {
            link: link,
            restrict: 'A'
        };
        return directive;

        function link(scope, element, attrs) {
            scope.date = new Date();

            var tick = function () {
                scope.date = new Date();
                $timeout(tick, 1000);
            };
            $timeout(tick, 1000);
        }
    }

})();