[英]Is there a way to listen to angular events like routechangestart from outside, like from browser console or an add on?
[英]Debug angular app from outside (browser console only)
我有这个有角度的网站,当所有内容连接在一起(未压缩)时,由于某种原因无法调试。 例如,如果我尝试设置一个断点,则该断点将放置在其他位置(在另一个文件的底部):(
因此,为了克服这个问题,我想使用浏览器控制台设置一个断点(如果可能的话)。
在当前情况下,我需要在服务方法内设置一个断点。 所以我想,我需要拥有该服务的参考资料。 但是棱角将那些保留在哪里。 例如,我尝试了这个
$> var myApp = angular.module('myApp');
$> debug(myApp.injector('someSevice').someMethod);
如果这行得通,我希望调试器在调用someMethod
时启动。
这是另一个失败的尝试:
$> myApp.run((someService) => { debug(someService.someMethod)});
任何帮助如何做到这一点将不胜感激?
更新:找到一种访问服务的方法
$> angular.injector(['myApp']).get('someService').someMethod
但是,就我而言,此函数仅在最初被调用
如果您要调试实时生产应用程序,则可能会禁用该网站的debug info
,而这样做实际上是为了increase performance
网站的increase performance
。 因此,使用angular.reloadWithDebugInfo();
在控制台中,然后尝试调试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.