rev087 / ng-inspector

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

Manual bootstrapping from the same file that bundles angular #109

Open rev087 opened 9 years ago

rev087 commented 9 years ago

Create a test with manual bootstrap done in the same file that bundles angular itself.

DrewML commented 9 years ago

Is this something that you already know works, and just want a test to guard against it, or are you actually looking to verify whether we handle this case?

rev087 commented 9 years ago

I havent tested it, but it almost certainly won't work, so maybe just writing a test would be silly. I wrote this issue quickly diring the last meeting.

DrewML commented 9 years ago

I have a theory for how we could address this. We'd basically need to change our mechanism we use for capturing angular's bootstrap method.

Instead of using mutation observers to listen for scripts being appended to the page, we could just configure window.angular to be a getter/setter. In that scenario, when the Angular lib loads and tries to assign to window.angular, our setter would catch it, swap the bootstrap method (as we do now), and then store a reference to the original angular object, that can be exposed through the getter.

I may hack up an example at some point just to play around with, and see if there are any obvious gotchas I'm not considering.