rev087 / ng-inspector

The AngularJS inspector pane for your browser
ng-inspector.org
MIT License
782 stars 93 forks source link

Supporting $compileProvider.debugInfoEnabled(false) #86

Open DrewML opened 9 years ago

DrewML commented 9 years ago

This is regarding the issue reported in #69.

I was reading through the Angular docs tonight, and I noticed this interested piece of info:

If you wish to debug an application with this information then you should open up a debug console in the browser then call this method directly in this console:

angular.reloadWithDebugInfo(); The page should reload and the debug information should now be available.

I think it would be awesome if we supported this use-case. Debugging production applications is certainly useful, and the docs mention that enabling this feature results in a "significant performance boost."

The problem: Having debug info disabled exhibits the exact same behavior that bootstrapping on an element with transclusion causes(issue #84, #57). The behavior is that the $injector is not accessible from the data getter on an angular.element object. This makes it impossible (from what I can tell) to determine if the user actually has debug info disabled or not.

I'm logging this issue now, in hopes that we can find a solution at some point to better notify the end-user. I'll take a look at how Batarang handles it. If it causes issues with Batarang as well, maybe we can attempt to convince the Angular team to expose whether or not the app is in debug mode.

nullstatement commented 9 years ago

We can try using using angular.element(document.body).injector().get('$rootScope') to get the rootscope when debugInfoEnabled(false). See http://stackoverflow.com/questions/24595460/how-to-access-update-rootscope-from-outside-angular