AngularJS - 获取子窗口参考$ rootscope [英] AngularJS - Get reference to $rootscope in child window

查看:111
本文介绍了AngularJS - 获取子窗口参考$ rootscope的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从父揭开序幕在子浏览器窗口中的角事件。我的第一个想法是,如果我有模块名称,我应该能够从角全局对象获取到 $ rootScope 的参考,但我一直没能得到那个工作。

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.

有谁知道从角?

先谢谢了。

推荐答案

如果你有一个ID在你的 NG-应用

If you have an id on your ng-app

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

您可以得到 $ rootScope

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

这篇关于AngularJS - 获取子窗口参考$ rootscope的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆