Angular - Blink Tag
by jazahn
HTML
<div ng-app="blink">
<blink><blink>Hello, Friend</blink></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
};
});