JSFiddle - React, Tailwind, and code Playground
by johnwun
HTML
<div ng-app='App'>
<div ng-controller='Controller'>
<button ng-click='toggle()'>toggle</button>
<div ng-show2='test'> visible</div>
</div>
</div>
JavaScript
var App = angular.module('App', []);
App.controller('Controller', function($scope,$timeout){
$scope.test = true;
$scope.toggle = function(){ $scope.test = !$scope.test; };
$timeout( $scope.toggle,400);
});
App.directive('ngShow2', function() {
return {
replace: true,
restrict: 'A',
link: function(scope, element, attr){
scope.$watch(attr.ngShow2, function(value){
console.log(scope.test);
});
}
};
});