Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS - Get reference to $rootscope in child window

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.

like image 598
Kywillis Avatar asked Jun 12 '13 20:06

Kywillis


1 Answers

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()
like image 145
Foo L Avatar answered Oct 13 '22 10:10

Foo L