title: angular.element(..).scope() returns undefined initially
body: <p>I am trying to access my angular controller's scope outside of the controller. I am using an external js library which performs certain actions and on completion executes certain callbacks. In one of the callbacks <code>angular.element(document.findElementById('elementId').scope()</code> returns <code>undefined</code>.
  But in the second callback that is executed after the first 
  <code>angular.element(document.findElementById('elementId').scope()</code> returns the valid scope.</p>
  
  <p>Here is some sample code</p>
  
  <pre><code>    &lt;body id="authcontroller" ng-controller="AuthenticationController as auth"&gt;
  
  &lt;script&gt;
      window.externalLibObj = {
       onCallback1: function(){
           // Undefined value for scope
           var scope = angular.element(document.getElementById('authcontroller')).scope();
       },
       onCallback2(): function(){
          // Valid value for scope
          var scope = angular.element(document.getElementById('authcontroller')).scope();
       }
      };
  &lt;/script&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p>The order in which these callbacks are executed are <code>onCallback1</code> and then <code>onCallback2</code>. <code>var scope</code> is undefined in <code>onCallback1</code> but has a value in <code>onCallback2</code></p>
  
  <p>Why is <code>scope</code> undefined in <code>onCallback1</code>?</p>
  
  <p>Thank you for your help</p>