如何从Angular 4.2.4升级到Angular 4.3 [英] How to upgrade from Angular 4.2.4 to Angular 4.3
问题描述
我在应用程序中使用的是angular 4.2.4,我想升级到最新版本(4.3.0)
I'm using angular 4.2.4 in my application and I want to upgrade to the latest one (4.3.0)
有没有一种简单且安全的方法可以在不破坏我的应用程序的情况下进行操作?
is there an easy and safe way to do that without breaking my application ?
搜索时,我从以下位置找到了此信息:
When searching I found this information from:
http://angularjs.blogspot.de/2017/07/angular-43-now-available.html
该链接指出Angular 4.3没有重大更改吗?
that link states that Angular 4.3 contains no breaking changes ?
我想进行升级以使用 HttpClient
推荐答案
我认为您应该没问题.引用新软件包后,只需确保您的ng build --prod
没有损坏.
I think you should be fine. Once you reference the new packages just make sure that your ng build --prod
is not breaking.
如果要使用新的HttpClient
,则已更改引用@angular/http
中Http
的代码的所有部分,并根据样式指南将其替换为@angular/common/http
中的HttpClient
.
If you want to use the new HttpClient
you have change all parts of your code that referencing Http
from @angular/http
and replace that with HttpClient
from @angular/common/http
according with styleguide.
此外,除非您不关心测试,否则还必须更改所有引用旧的Http
的相关.spec
文件,然后使用ng t
进行测试.
Also you have to change to all related .spec
files that referencing old Http
as well, then test with ng t
, unless you does not care about tests.
如果您希望如何更有效地升级所有与角度相关的软件包,请点击此处如何正确将Angle 2(npm)升级到最新版本?
If you are looking how upgrade all angular related packages more efficiently just look here How do I correctly upgrade angular 2 (npm) to the latest version?
这篇关于如何从Angular 4.2.4升级到Angular 4.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!