title: Angular Js Directive communication detecting if another directive is on in the scope
body: <p>I know there is a way to make directives communicate with each other. You can do it through using controllers. My problem is I have 2 directives on the page I am creating a upload app, I am using a file change directive that detects whether or not a file input has been used to select a file and a directive that creates a dropzone for dragging and dropping files both are working. </p>
  
  <p>But how do I make the app detect whether the dropzone or filechange directive are being used on the page I created a factory method and am using a a data service with an array to push the names of the directives into the array. but when it does even though both are on the page only one is registering? how do I fix this? is it an async issue? </p>
  
  <p>here is my uploader3.js</p>
  
  <pre><code>var app = angular.module("uploader", []);
  app.factory('data', function(){
  
  return {
  
      directives:[],
      progressBarSet:false,
      getData:function(){
  
          return this;
  
      }
  
     }
  
  });
  
  
  app.directive("dropzone", ["data", function (data) {
  
  return {
  
      restrict: "A",
      controller: function($scope){
  
      },
      priority: 0,
      link: function (scope, element, attr, ctrl) {
  
           data.directives.push("dropzone");            
           console.log(data.directives);
      }
  
    }
  
  }]);
  
  
  
  
  app.directive("filechange", ["data", function (data) {
  
  return {
  
      restrict: "A",
      controller: function($scope){
  
      },
      priority: 1,
      link: function (scope, element, attr, ctrl) {
  
           data.directives.push("filechange");            
           console.log(data.directives);
      }
  
    }
  
  }]);
  </code></pre>
  
  <p>here is my html.</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html ng-app="uploader"&gt;
  &lt;script src="Scripts/angular.min.js"&gt;&lt;/script&gt;
  &lt;script src="app/uploader3.js"&gt;&lt;/script&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body dropzone&gt;
      &lt;input type="file" name="FILEDATA" id="FILEDATA" accept="image/jpg, image/jpeg" filechange&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I log the the data.directives it shows that I it has a length of 1? how do I apply the push and get both of the directives to register in my data service?</p>
  
  <p>Is there a better way to figure out what directives are actually being applied on the page?
  I need to execute the next set of code based on whether or not the dropzone or file change directive has been implemented on the page, or if both are being used.</p>