Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ngUpgrade in production app/website?

We have an app/website using Angular 1.5. It'll take time to convert everything to Angular 2 and it isn't a priority as what we have currently work.

I was thinking it could be interesting for new components/directive/services to write them in Angular 2, to avoid having to eventually convert them later on, as well as to start learning the new syntax.

But is it really a good idea to ship something containing Angular 1.5 and 2 with ngUpgrade? The memory footprint should end up being bigger, but are there other drawbacks?

The following article http://blog.thoughtram.io/angular/2015/10/24/upgrading-apps-to-angular-2-using-ngupgrade.html by Pascal Precht mentions: Keep in mind that the goal of this [upgrade] phase is to stay in it as little as possible, since running both frameworks on the same website is surely not ideal. but that doesn't tell us much.

Does anyone have feedbacks with a "real" (ie not tiny or proof of concept) partial update using ngUpgrade?

like image 808
user276648 Avatar asked Nov 08 '22 18:11

user276648


1 Answers

We have a large commercial product (banking web-application) and we use a hybrid application on production.

We migrate services and components from AngularJS 1.5 to Angular 6, and it will take at least a half year.

A few tips:

  1. To avoid all issues with $digest and performance I recommend using DowngradeModule - it bootstraps AngularJS outside of the Angular zone and keeps the two change detection systems separate. The first hybrid app used UpgradeModule and we had a lot of problems, - this approach is not for large applications.

  2. Use similar code before bootstrapModule(AppModule)

import { enableProdMode } from '@angular/core';

if (IS_PRODUCTION) {
   enableProdMode();
}

If you have any questions - you are welcome.

like image 193
Oleg Dikusar Avatar answered Nov 15 '22 07:11

Oleg Dikusar