Get Service instance via console

In Angular 1, you could get the injector via the console, which allowed you to then get any service:

angular.element(document.querySelector('html')).injector().get('MyService')

This was extremely useful for debugging. What's the equivalent in NG2?


You can use ng.probe($0) in the console to get debug information about your Angular2 application.

See also how to access Angular2 component specific data in console?

But that is not available when enableProdMode() was called (only for debuggin)

链接地址: http://www.djcxy.com/p/93576.html

上一篇: 如何在python硒中获取标题

下一篇: 通过控制台获取服务实例