简体   繁体   English

更新到 Angular 9

[英]Updating to Angular 9

I want to update an existed app that was developped by Angular 2 to the latest Angular 9, I found some tutorials我想将由 Angular 2 开发的现有应用程序更新到最新的 Angular 9,我找到了一些教程

How to update angular 2 in Angular CLI How to upgrade Angular CLI to the latest version https://medium.com/@satyapriyamishra111/how-to-upgrade-angular-2-4-5-application-to-angular-6-85c7775896c2 https://update.angular.io/#2.0:9.0 How to update angular 2 in Angular CLI How to upgrade Angular CLI to the latest version https://medium.com/@satyapriyamishra111/how-to-upgrade-angular-2-4-5-application-to-angular-6- 85c7775896c2 https://update.angular.io/#2.0:9.0

I'm still new to angular so will I just want to know if I will need to change syntaxes within the code我还是 angular 的新手,所以我只想知道是否需要更改代码中的语法

Yes.是的。 Some of the Angular modules have changed, things like RxJS have changed (you didn't used to use.pipe, now you do), components have changed, configurations have changed.部分Angular模块变了,RxJS变了(以前没用过pipe,现在变了),组件变了,配置变了

Your best bet is to scaffold a new Angular 9 app, take the old app code (WITHOUT any of the configuration files, like the tsconfigs etc), and just slog through it.你最好的办法是搭建一个新的 Angular 9 应用程序,获取旧的应用程序代码(没有任何配置文件,如 tsconfigs 等),然后慢慢完成它。

I've had to update a number of fairly large Angular apps.我不得不更新一些相当大的 Angular 应用程序。 Anything 6+ to the latest is pretty easy.任何 6+ 到最新的东西都很容易。 Anything 4+ is not too bad, but is work.任何 4+ 都不算太糟糕,但就是工作。 If you're going all the way back to 2, that can be painful.如果你一直回到 2,那可能会很痛苦。

This is all assuming the app you're updating is large.这一切都假设您正在更新的应用程序很大。 If it's relatively small, a handful of components living in the app.module, then it won't be too bad, you'll need to update HTTPModule to HttpClientModule and that sort of thing, and if you have any pipes for data (RxJS) you'll have to dig into that.如果它相对较小,app.module 中存在一些组件,那么它不会太糟糕,你需要将 HTTPModule 更新为 HttpClientModule 之类的东西,如果你有任何数据管道(RxJS ) 你必须深入研究它。 But a large app with lots of assets, path configs, lots of modules loading lots of data...that'll take time.但是一个包含大量资产、路径配置、大量加载大量数据的模块的大型应用程序......这需要时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM