JSFiddle - React, Tailwind, and code Playground

by Jscaptcha

HTML

<div ng-app='myApp'>
    <my-clock format="HH:mm:ss"> </my-clock>
</div>

JavaScript

var myApp =angular.module('myApp',[]);
myApp.directive('myClock',['dateFilter','$timeout',function(dateFilter,$timeout){
	return {
    
    		restrict :'E',
        	scope:{
            	format:'@'
            },
        	link:function(scope,elem,attrr){
        			var updateTime = function(){
        				var getCurrntTime = Date.now();
        				elem.html( dateFilter(getCurrntTime,scope.format));
    					$timeout(updateTime,1000);
    				}        			
        			updateTime();
    		}
    };
}
]);