You can do it:
angular.module('example').directive('dir1', function () {
return {
restrict: 'A',
scope: true,
controller: 'ExampleCtrl',
controllerAs: 'dir1Ctrl'
};});
angular.module('example').directive('dir2', function () {
return {
restrict: 'A',
scope: true,
controller: 'ExampleCtrl',
controllerAs: 'dir2Ctrl'
};});
Then in the controller $scope.dirNcontroller, where Nis equal to 1 or 2 or as much as you have, it will exist only if it came from a directive N. This is how the syntax works controllerAs, it just publishes in the field.
Something like that:
app.controller('ExampleCtrl', function($scope, $element) {
if ($scope.dir1Ctrl)
if ($scope.dir2Ctrl)
});
Plunker
Mosho source
share