JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<div ng-app="sembaApp" ng-init="popup1=false;popup2=false;">
<popup class="popup" ng-model="popup1">
<pop data-ng-show="popup1">I popped up</pop>
</popup>
<popup class="popup" ng-model="popup2">
<pop data-ng-show="popup2">I popped up too</pop>
</popup>
</div>
JavaScript
angular.module('sembaApp', [])
.directive('popup', function () {
return {
scope:{
ngModel: '='
},
restrict: 'E',
replace: true,
transclude: true,
template: '<div data-ng-transclude><a href="#" data-ng-click="showPopup()">Show Popup</a></div>',
link: function postLink($scope, $element, $attrs) {
$scope.showPopup = function () {
console.log($scope.ngModel);
$scope.ngModel = !$scope.ngModel;
}
}
}
})