Angular - Blink Tag

by jazahn

HTML

<div ng-app="blink">
    <blink>&lt;blink&gt;Hello, Friend&lt;/blink&gt;</blink>
</div>

JavaScript

var blink = angular.module('blink', [])
    .directive('blink', function($timeout) {
    return {
        restrict: 'E',
        controller: function($element, $attrs) {
            this.speed = $attrs.speed || 500;
            that = this;
            this.promise;
            this.blinking = true;
            var showElement = function() {
                $element.css("visibility", "visible"); 
                that.promise = $timeout(hideElement, that.speed);
            };
            var hideElement = function() {
                $element.css("visibility", "hidden");
                that.promise = $timeout(showElement, that.speed);
            };
            showElement();
        },
        replace: true
    };
});