Sample Analysis of Angular5.2 to 6.1upgrade
This article mainly introduces the Angular5.2 to 6.1 upgrade example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
As mentioned in the previous article, angular6 cannot be upgraded basically without feeling like Angular4 to Angular5 because of some slightly larger changes. Here, combined with official tips, briefly sort out the key points of upgrading Angular5.2 to the current stable 6.1.
Prepare beforehand
Change content
In addition, you need to confirm the following:
Tsconfig.json: preserveWhitespaces is set to off (V6 default)
With the use of scripts in package.json, all cli commands use two horizontal lines-incoming parameters (POSIX specification)
If the ngModelChange behavior changes, please make sure that you use the relevant method and whether the action is normal after the upgrade.
When Typescript uses strict mode (when tsconfig.json 's strict is set to true), update tsconfig.json to invalidate strictPropertyInitialization, or remove the initialization of attributes in ngOnInit
Update
Update cli
Node version confirmation: Node8 and above
Update local and global angular cli
Modify the configuration file angular.json
You can do this using the following command:
Sudo npm install-g @ angular/cli@6.1.5
Npm install @ angular/cli@6.1.5
Ng update @ angular/cli
Update angular framework
Update Angular framework to V6 and the corresponding RxJS and TypeScript versions
Ng update @ angular/core
Update Angular Material
Ng update @ angular/material
Update other package
Ng update
Modification of rxjs
Rxjs can be compatible with rxjs-compat mode, and then removed after the correspondence is completed.
Thank you for reading this article carefully. I hope the article "sample Analysis of Angular5.2 to 6.1 upgrade" shared by the editor will be helpful to you. At the same time, I also hope you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!