JSFiddle - React, Tailwind, and code Playground
by justbn
HTML
<body ng-app="app">
<test-directive activate="1"></test-directive>
</body>
JavaScript
var app = angular.module('app', []);
app.directive('testDirective', function() {
return {
restrict: 'E',
scope: {
activate : '='
},
link: function( scope, elem, attrs, controller ) {
var el = elem[0];
var updateContent = function() {
el.innerText = 'Activate=' + scope.activate;
};
updateContent();
attrs.$observe( 'activate', function() {
console.log('Activate=' + scope.activate);
if( scope.activate == '1') {
scope.activate = '0'
updateContent();
}
});
}
}
});