title: Accessing parent window angular scope from child window
body: <p>I'm trying to update scope value on parent window from a child popup.But whenever I try to access the parent window scope,it returns undefined. As it involves two window, I couldn't create a fiddle for this. Code sample is pasted below.</p>
  
  <p><strong>Main page (main.html)</strong></p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
       var myApp = angular.module('myApp',[]);
       function MyCtrl($scope) {
          $scope.name = 'Superhero';
      }
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body ng-app="myApp"&gt;
     &lt;div id="ctrl" ng-controller="MyCtrl"&gt;
        Hello, {{name}}!
        &lt;input type="button" value="Open popup!!" onclick="window.open('child.html');"/&gt;
      &lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Child window (child.html)</strong></p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html &gt;
    &lt;head&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
       function change(){
        var e = window.opener.document.getElementById('ctrl');
        var ae = angular.element(e);
        var s = ae.scope();
        s.name="New Superhero";
        s.$apply();
       }
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;input type="button" value="Update parent scope!" onclick="change();"/&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here whenever I try to access scope from the angular element , as shown above in change method, it returns undefined [ae.scope()].But when the same code moved to a function in parent window [only difference in how 'ctrl' element is being accessed], it worked fine and I was able to update the scope variable. Can anyone point out what actually is going wrong here? Thanks</p>