JSFiddle - React, Tailwind, and code Playground
by Sai Baba Satchitanand
HTML
<div ng-app="hello" ng-controller="MyCtrl">
<hello name="{{name}}"></hello>
</div>
JavaScript
function MyCtrl($scope,$timeout){
$scope.name = "Hello";
$timeout(function(){
$scope.name = "Hello world";
},5000);
}
angular.module('hello', []).directive('hello', function () {
return {
restrict: 'E',
template: '<span>Hello!</span>',
link: function(scope,elm,attr){
elm.bind('click',function(){
alert(attr.name);
});
attr.$observe("name",function(newVal){
console.log(newVal);
});
}
};
});