Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual bootstrapping angular not supported #34

Open
alex-hall opened this issue Jan 20, 2017 · 3 comments
Open

Manual bootstrapping angular not supported #34

alex-hall opened this issue Jan 20, 2017 · 3 comments

Comments

@alex-hall
Copy link
Contributor

alex-hall commented Jan 20, 2017

As per Angular 2 documentation:

Pure Angular 1 applications can be bootstrapped in two ways: By using an ng-app directive 
somewhere on the HTML page, or by calling angular.bootstrap from JavaScript. In Angular 2, only 
the second method is possible - there is no ng-app in Angular 2. This is also the case for hybrid 
applications. Therefore, it is a good preliminary step to switch Angular 1 applications to use the 
JavaScript bootstrap method even before switching them to hybrid mode.

So in order to get this gem working with Angular 2 or even hybrid ng-upgrade apps, ng-app can no longer be required.

The protractor documentation solved this problem in a similar way to how the gem has solved it, so only minor updates are required.

I have already forked the gem and made the change here: #33

@alex-hall alex-hall reopened this Jan 24, 2017
@alex-hall
Copy link
Contributor Author

@wrozka Some coworkers brought up the fact that this solution ONLY works if you use ng-app on the body tag. Note that this is the recommendation on the angular docs, but could potentially be considered a regression.

A safer change might be to grep for $('[ng-app]') first, then fall through to $('body') if that tag is not found. If you care about this backwards compatibility let me know, i'll create another/update the pull request.

@wrozka
Copy link
Owner

wrozka commented Jan 25, 2017

Thanks for spotting that, I missed that, please update the pull request if you can.

@alex-hall
Copy link
Contributor Author

I'll do this today.

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

Successfully merging a pull request may close this issue.

2 participants