AngularJS - Get reference to $rootscope in child window

angularjs, javascript

Solution

If you have an id on your `ng-app`

<div id="app-container" ng-app="myApp">

You can get the `$rootScope` by:

angular.element('#app-container').scope()

Problem

I need to kick off an angular event in a child browser window from a parent. My first thought was if I had the module name I should be able to get a reference to the `$rootScope` from the angular global object but I have not been able to get that to work. Does anyone know the best way to reference the `$rootScope` object from outside the context of angular? thanks in advance.

Original source