1

If I want to use the Angular-upgrade module in my Angular1 application it seems like I have to bootstrap the whole app using Angular2's bootstrapping, including ditching the ng-app declaration. My team is very interested in graduating our apps' components over time to Angular 2, but touching the bootstrapping is a little too impactful for us at this moment.

In order to use the Upgrade Adapter do I have to transform the way my app bootstraps in order to use an Angular2 component? Is there anyway to use an Angular2 component in a full Angular1 app?

Here's a great article that describes multiple scenarios for upgrading, but none of them leave the app bootstrapped as a normal Angular1 app.

Charles Harris
  • 304
  • 1
  • 2
  • 18

1 Answers1

2

Short answer is No. From angular 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.

For better understanding how upgrade works read this article from official documentation https://angular.io/docs/ts/latest/guide/upgrade.html

alexKhymenko
  • 5,450
  • 23
  • 40