I have a problem using directive multiple times on same page, if directive is defined multiple times on a page it calling only once.
Runnable demo: https://codepen.io/predatorz/pen/XWmPJwj
angular.module('DemoApp.directives', []).
directive('popupDirective', function () {
return {
scope: {
visible: '=?',
},
restrict: 'EA',
template: '<div dx-popup="popupOptions"></div>',
link: function (scope, elem, attrs) {
scope.visible = scope.visible || false;
},
controller: function($scope){
console.log('controller is called');
$scope.popupOptions = {
width: 300,
height: 250,
showTitle: true,
title: 'Information',
bindingOptions: {
visible: "visible",
}
};
}
};
});
html:
<popup-directive visible="visiblePopup"/>
<popup-directive visible="visiblePopup2"/>