Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

migrating from Angular 6 to Angular 7

I have recently upgraded my Angular 4 app to Angular 6 and now want to upgrade to Angular 7. According to the below article , running command the following command shouldn't take more than 10 mins to upgrade.

ng update @angular/cli @angular/core

https://blog.angular.io/version-7-of-angular-cli-prompts-virtual-scroll-drag-and-drop-and-more-c594e22e7b8c

I dont see anything happening on the command prompt after running this command. No errors. Could somebody tell me why this is happening

like image 205
Tom Avatar asked Oct 22 '18 19:10

Tom


People also ask

How do I migrate a project from Angular 11 to Angular 12?

Run ng update @angular/core@12 @angular/cli@12 which should bring you to version 12 of Angular. Angular now requires TypeScript 4.2. ng update will update you automatically.

How do I upgrade ng to a specific version?

How do I upgrade ng to a specific version? ng updatelink 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@^ @angular/core@^ .

How do I upgrade my Angular project?

Upgrade Angular CLI globally First, check your current Angular CLI version by running command. Note that if you run this command inside Angular project directory then you will get Angular project's version. If you run it outside Angular version then you will get global Angular CLI version.


3 Answers

I've updated 6 to 7 using:

Angular dependencies

   npm install @angular/animations@latest @angular/common@latest @angular/compiler@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest --save

Angular dev dependencies

  npm install @angular-devkit/build-angular@latest @angular/compiler-cli@latest @angular/cli@latest @angular/language-service@latest --save-dev

Dependencies; Core-js and Zone.js

npm install core-js@latest zone.js@latest --save

Dev dependencies; Types, codelyzer, karma tools, jasmine, protractor and tslint

npm install @types/jasmine@latest @types/node@latest codelyzer@latest karma@latest karma-chrome-launcher@latest karma-cli@latest karma-jasmine@latest karma-jasmine-html-reporter@latest jasmine-core@latest jasmine-spec-reporter@latest protractor@latest tslint@latest --save-dev

The new version 3+ of TypeScript

npm install typescript@latest --save-dev

Latest version 6+ of RxJS

npm install rxjs@latest rxjs-compat@latest --save

And:

npm install rxjs-tslint@latest --save-dev

Latest version 4+ of Webpack

npm install webpack@latest --save-dev

source

like image 128
mrapi Avatar answered Sep 17 '22 18:09

mrapi


ANGULAR 6.1 to 7 MIGRATION PROCEDURE

In order to upgrade properly from Angular 6.1 to angular 7, you have to follow the next steps:

WARNING: Please check if all your imported modules are compatible with angular 7, upgrade them if necessary.

Before upgrade to Angular 7:

  1. Change the HttpModule import to HttpClientModule (import {HttpClientModule} from '@angular/common/http';)

  2. Change the Http imports (if you have any) to import {HttpClient} from '@angular/common/http';

Don´t forget to remove all JSON.parse(response), since you don´t need to do that anymore with HttpClient

  1. If you are using RXjs, you have to remove RXjs 6 old dependencies. No worries, you can do that running the following scripts:

    npm install -g rxjs-tslint

    rxjs-5-to-6-migrate -p src/tsconfig.app.json

You may have to update typescript in order to migrate rxjs successfully: npm i -g typescript

  1. Uninstall rxjs-compat module (npm uninstall rxjs-compat)
  2. If you use the Angular Service worker, migrate any versionedFiles to the files array.

  3. Update angular cli to v7:

    ng update @angular/cli

  4. Update angular Core to v7:

    ng update @angular/core

  5. Finally you have to upgrade Angular material:

    ng update @angular/material

like image 38
Jorge Valvert Avatar answered Sep 20 '22 18:09

Jorge Valvert


here,you can find guide related to update from any version to angular 7

https://update.angular.io/

Or you can simply run a command into your CLI

  ng update --all
like image 29
Pooja Patel Avatar answered Sep 20 '22 18:09

Pooja Patel