JSFiddle - React, Tailwind, and code Playground
by GruffBunny
HTML
<div ng-app='MyModule' ng-controller='MyController'>
<div graphfingerprint="present" val="data"></div>
<button ng-click='changePresent()'>Press me</button>
</div>
JavaScript
angular.module('MyModule', [])
.controller( 'MyController', function($scope){
$scope.present = false;
$scope.changePresent = function(){
$scope.present = true;
console.log($scope.present);
};
})
.directive( 'graphfingerprint', function(){
return {
restrict: 'A',
scope : {},
template: '<p>present is {{present}}</p>',
link: function(scope, element, attrs) {
var expression = scope.present
scope.$watch(expression, function(newValue){
if( newValue === true) alert('hello');
});
}
};
});