You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Embedding an upgraded AngularJS component in an Angular application results in an error message: Error: Trying to get the AngularJS injector before it being set.
Expected behavior
An upgraded AngularJS component should be able to be used in an Angular application with no errors.
Minimal reproduction of the problem with instructions
I ran into this problem while following the instructions on using AngularJS components in an Angular application here: https://angular.io/guide/upgrade.
Generated a new Angular (v5.2.0) app using the Angular CLI (v1.7.3): ng new angular-app
Generated a new AngularJS module using a custom Yeoman generator. Built the module and npm link-ed it into the Angular app generated in the previous step.
Built and ran the application. This caused the following error to be thrown in the console:
Error: Trying to get the AngularJS injector before it being set.
at injectorFactory (static.js:694)
at _callFactory (core.js:10914)
at _createProviderInstance$1 (core.js:10868)
at resolveNgModuleDep (core.js:10850)
at NgModuleRef_.get (core.js:12087)
at Object.resolveDep (core.js:12577)
at Injector_.get (core.js:11734)
at new UpgradeHelper (static.js:809)
at ExampleDirective.UpgradeComponent (static.js:1114)
at new ExampleDirective (example.component.ts:10)
Angular version: 5.2.0
Browser:
- [x] Chrome (desktop) version 65.0.3325.181 (Official Build) (64-bit)
- [?] Chrome (Android) version XX
- [?] Chrome (iOS) version XX
- [x] Firefox version 59.0.2 (64-bit)
- [?] Safari (desktop) version XX
- [?] Safari (iOS) version XX
- [?] IE version XX
- [x] Edge version 40.15063.674.0
For Tooling issues:
- Node version: 8.9.1
- Platform: Windows 10
Others:
Angular CLI version: 1.7.3
The text was updated successfully, but these errors were encountered:
When declaring bootstrap components in an NgModule, ngDoBootstrap() is not called.
Quoting the upgrade guide:
Note that you do not add a bootstrap declaration to the @NgModule decorator, since AngularJS will own the root template of the application.
Alternatively, if you want/need to specify a bootstrap component, you can move the upgrade.bootstrap() call from the module's ngDoBootstrap() method to the bootstrap component's ngOnInit() lifecycle hook.
@AminRahimi, you cannot directly bootstrap an Angular component that contains upgraded components before bootstrapping AngularJS. Instead, you can downgrade AppComponent and let it be bootstrapped as part of the AngularJS part of the app: demo
I'm submitting a...
Current behavior
Embedding an upgraded AngularJS component in an Angular application results in an error message:
Error: Trying to get the AngularJS injector before it being set.
Expected behavior
An upgraded AngularJS component should be able to be used in an Angular application with no errors.
Minimal reproduction of the problem with instructions
I ran into this problem while following the instructions on using AngularJS components in an Angular application here: https://angular.io/guide/upgrade.
I've created a repository that demonstrates the issue here: https://github.com/nfriend/angularjs-in-angular-bug-repro. Instructions on how to build the application are included in the repository's README.
At a high level, here are the steps I took:
ng new angular-app
npm link
-ed it into the Angular app generated in the previous step.app.module.ts
and bootstrapped AngularJS in thengDoBootstrap
hook:app.component.html
:I'm not sure if this is a real bug or just an issue with the upgrade documentation (https://angular.io/guide/upgrade).
Environment
The text was updated successfully, but these errors were encountered: