Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

Breaks manually bootstrapped apps (does not return $injector) #163

Closed
kentcdodds opened this issue Dec 10, 2014 · 13 comments
Closed

Breaks manually bootstrapped apps (does not return $injector) #163

kentcdodds opened this issue Dec 10, 2014 · 13 comments

Comments

@kentcdodds
Copy link
Member

I'm not sure how this happens, but if you open this jsbin output in a browser without the extension (or an older version) then it works just fine. If you open it with 0.5.0, it doesn't bootstrap and there's an error in the console.

This example seems to be failing for a different reason that my app, but in both cases, angular.bootstrap is returning undefined instead of $injector as it should.

@kentcdodds kentcdodds changed the title 0.5.0 Breaks manually bootstrapped apps 0.5.0 Breaks manually bootstrapped apps and controller as Dec 10, 2014
@kentcdodds
Copy link
Member Author

I think this is actually two separate issues:

  1. Batarang is having trouble with controller as
  2. angular.bootstrap isn't returning the $injector as it should when batarang is installed.

@btford
Copy link
Contributor

btford commented Dec 10, 2014

@btford
Copy link
Contributor

btford commented Dec 10, 2014

Working on a fix for for second point

@btford btford changed the title 0.5.0 Breaks manually bootstrapped apps and controller as bug: >=v0.5.0 Breaks manually bootstrapped apps and controller as Dec 10, 2014
@marols
Copy link

marols commented Dec 10, 2014

I don't know if it helps, but from the investigations we have done at my company, we found that it seems Batarang alters window.name. At least if you set a breakpoint on row 1393 in the bootstrap function in angular.js (v1.2.15), you get different values for window.name depending on whether Batarang is enabled or not. The contents of the row is if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {

With Batarang enabled: window.name = "NG_DEFER_BOOTSTRAP!"
With Batarang disabled: window.name = "" (empty)

The not empty window name makes the if-statement evaluate to false which means the doBootstrap() function never runs and consequently the $injector is never returned

@btford
Copy link
Contributor

btford commented Dec 10, 2014

@marols – thank you for including this information.

I'm aware that the issue is that deferred bootstrap doesn't return the injector as expected. Working on a fix now.

@btford btford changed the title bug: >=v0.5.0 Breaks manually bootstrapped apps and controller as bug(v0.5.0): Breaks manually bootstrapped apps and controller as Dec 11, 2014
@bzitzow
Copy link

bzitzow commented Jan 7, 2015

+1

  1. angular.bootstrap isn't returning the $injector as it should when batarang is installed.

AngularJS Batarang 0.7.4

@SomeKittens SomeKittens changed the title bug(v0.5.0): Breaks manually bootstrapped apps and controller as Breaks manually bootstrapped apps (does not return $injector) Sep 24, 2015
@SomeKittens
Copy link
Member

@kentcdodds provided this JSBin repo: http://output.jsbin.com/wehufa

@kentcdodds
Copy link
Member Author

Just realized that the original had a jsbin as well that reproduces the issue :-)

@TombolaShepless
Copy link

Do we know how to fix this issue?

@SomeKittens
Copy link
Member

This appears to happen with all defers of bootstrapping, not just Batarang: http://jsbin.com/silaji/edit?html,js,output

Digging through Angular.js proper to see if there's a solution there.

@SomeKittens
Copy link
Member

From the docs:

Note that Protractor based end-to-end tests cannot use this function to bootstrap manually. They must use ngApp.

Batarang uses the same techniques as Protractor, so this is a limitation of Angular itself. Sorry about that folks...

@kentcdodds
Copy link
Member Author

Huh... That explains why my protractor tests act funny sometimes :-) I think that I'll have to rewrite my bootstrap to do something like this then. :-( Thanks for the tip!

@trajano
Copy link

trajano commented Mar 13, 2016

@kentcdodds still does not work for me with Meteor. It seems to be closed there too as a limitation Urigo/angular-meteor#90

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants