-
Notifications
You must be signed in to change notification settings - Fork 35
guide upgrade devon4ng
Angular CLI provides a powerful tool to upgrade Angular based applications to the current stable release of the core framework.
This tool is ng update
. It will not only upgrade dependencies and their related ones but also will perform some fixes in your code if available thanks to the provided schematics. It will check even if the update is not possible as there is another library or libraries that are not compatible with the versions of the upgraded dependencies. In this case it will keep your application untouched.
ℹ️
|
The repository must be in a clean state before executing a ng update . So, remember to commit your changes first.
|
In order to perform a basic upgrade we will execute:
$ ng update @angular/cli @angular/core
Important use cases:
-
To update to the next beta or pre-release version, use the
--next=true
option. -
To update from one major version to another, use the format
ng update @angular/cli@^<major_version> @angular/core@^<major_version>
. -
In case your Angular application uses
@angular/material
include it in the first command:$ ng update @angular/cli @angular/core @angular/material
Just following the same procedure we can upgrade Angular applications, but we must take care of important specific Ionic dependencies:
$ ng update @angular/cli @angular/core @ionic/angular @ionic/angular-toolkit [@ionic/...]
Every application will make use of different dependencies. Angular CLI ng upgrade
will also take care of these ones. For example, if you need to upgrade @capacitor
you will perform:
$ ng update @capacitor/cli @capacitor/core [@capacitor/...]
Another example could be that you need to upgrade @ngx-translate
packages. As always in this case you will execute:
$ ng update @ngx-translate/core @ngx-translate/http-loader
This documentation is licensed under the Creative Commons License (Attribution-NoDerivatives 4.0 International).