JSFiddle - React, Tailwind, and code Playground
HTML
<body ng-app="app" ng-controller="appCtrl">
<test-directive activate="activate.initialValue"></test-directive>
</body>
JavaScript
var app = angular.module('app', []);
app.controller('appCtrl', function($scope) {
$scope.activate = {
initialValue: 4
}
});
app.directive('testDirective', function($timeout) {
return {
restrict: 'E',
scope: {
activate: '='
},
link: function(scope, elem, attrs) {
scope.$watch('activate', function(newValue, oldValue) {
console.log('activate has changed', newValue);
});
$timeout(function() {
scope.activate = 0;
}, 2000);
},
template: "{{activate}}"
}
});