Update to Angular 8 using Ng-Update

770
SHARES
3.5k
VIEWS

In this article, you’ll learn about the required steps that you need to follow to appropriately migrate your existing Angular apps to Angular 8 — the latest version as of this writing.

Angular 8 is released with many new features for the core framework. The new version depends on the latest version of TypeScript and NodeJs. Let’s see how we can update the Angular CLI to Angular CLI 8 and upgrade an existing project from using Angular v7 to Angular v8.

What is Ng-Update?

Ng-Update is a command available from Angular CLI used to update your application and its dependencies. You can see all available commands from the official docs.

How to Update to Angular 8

You can update to the latest Angular 8 release using one command:

$ ng update @angular/cli @angular/core

If you have issues. You can also check  here for more details.

How to Update to Angular 7

You can find more details about the update process from the official website  update.angular.io

In most cases, you can update to version 7 by running one simple command:

$ ng update @angular/cli @angular/core

Updating from Angular 6 to Angular 7 (Basic Apps)

if your project is basic, you can simply try the following steps:

  • First, you need to remove the deprecated features of RxJS 6 using the auto-update rules from rxjs-tslint. You simply need to install the tool globally using the npm install -g rxjs-tslintcommand then run the rxjs-5-to-6-migrate -p src/tsconfig.app.json from the root of your project. Once it’s done you can remove the rxjs-compat library.
  • Finally, you simply have to run the ng update @angular/cli @angular/core command to update to v7 the core framework and the CLI.

Updating Advanced Apps

If your project uses advanced APIs like HTTP, you need to replace the old HttpModule and the Httpservice (which was deprecated in Angular v6) with the new HttpClientModule and the HttpClient service that brings a lot of new powerful features.

Also if your applicaton makes use of the Angular Service worker, you need to migrate any versionedFiles to the files array.

Aside from what’s stated above, you don’t need to perform any changes in your project to migrate from Angular v6.1 to Angular v7.

Conclusion

In this tutorial, we’ve seen step by step how to ng update the Angular CLI to version 6, how to upgrade an existing Angular to Angular 8.

Best resources to learn Angular, Firebase and ionic 4

Muhammad Mubeen

Muhammad Mubeen

Mubeen is a full-stack web & mobile app developer who is very proficient in MEAN.js, Vue, Python, Ionic 4, Flutter, Firebase, ROR, and PHP. He has created multiple mobile and web applications. He is very passionate about sharing his knowledge.

Comments 2

  1. Emma Clark says:

    Hello, Mubeen.
    Actually, I have been combing the net looking for an eye-catching topic of angular until I was almost about to give up luckily I stumbled upon this your marvelous post. The whole content mentioned by you gives a beautiful and straightforward way to begin for beginners and to finish transparently. All information about angular and Ng-update mentioned by you in this post are marvelous. Thanks for sharing this valuable post.

Leave a Reply

Your email address will not be published. Required fields are marked *

Trending