如何调试angularjs的$ rootScope对象在浏览器 [英] how to debug the $rootScope object of angularjs in the browser
本文介绍了如何调试angularjs的$ rootScope对象在浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有当它在浏览器中加载调试angularjs应用程序的方式吗?
Is there a way of debugging the angularjs application when it is loaded in the browser?
IE浏览器。我希望得到的 $ rootScope
我目前的应用。我会怎么做呢?
ie. I wish to get the $rootScope
of my current application. How would I do that?
推荐答案
+1 Batarang
+1 for Batarang
此外,您还可以通过从控制台执行以下获得任何元素的范围在DOM
Also, you can get the scope from any element in the DOM by executing the following from the console
angular.element(DOMNODE).scope()
在哪里れ,当然是一个DOM节点的引用。
Where DOMNODE, is of course, a reference to a DOM node.
例如,在Chrome在元素标签,你可以选择其中 NG-应用
指令是节点,并得到根范围内以
For example, in Chrome in the elements tab you can select the node where the ng-app
directive is, and get the root scope with
angular.element($0).scope()
这篇关于如何调试angularjs的$ rootScope对象在浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文