Upgrade Angular 8 to Angular 9 | Upgrade angular cli 9

Upgrade Angular 8 to Angular 9


Before Updating 

B.Step 1

Instead of importing from @angular/material, you should import deeply from the specific component. 

E.g. import {MatAutocompleteModule} from '@angular/material/autocomplete';. 
ng update will do this automatically for you.

B.Step 2

For lazy loaded modules via the router, make sure you are using dynamic imports. Importing via string is removed in v9. ng update should take care of this automatically. 

Before 
const routes: Routes = [{
  path: 'lazy',
  // The following string syntax for loadChildren is deprecated
  loadChildren: './lazy/lazy.module#LazyModule'
}];
After
const routes: Routes = [{
  path: 'lazy',
  // The new import() syntax
  loadChildren: () => import('./lazy/lazy.module').then(m => m.LazyModule)
}];
B.Step 3

Running Angular itself in a web worker via @angular/platform-webworker is not yet supported in Angular CLI.
B.Step 4
Support for web tracing framework in Angular was deprecated in version 8. You should stop using any of the wtf* APIs.

During the Update

D.Step 1

Make sure you are using Node 10.13 or later. to check run node -v using terminal or command prompt.

D.Step 2

Run ng update @angular/core@8 @angular/cli@8 --create-commits --allow-dirty  --force  . which brings your  project to latest 8.x version 

D.Step 3

Run ng update @angular/core @angular/cli --create-commits --allow-dirty --force which should bring you to version 9 of Angular.Your project has now been updated to TypeScript 3.7

D.Step 4

if you are using material angular Run ng update @angular/material --create-commits --allow-dirty --force.

D.Step 5

If your project depends on other Angular libraries,run ng update .

D.Step 6: 
More about the changes refer : Angular 9 Version Changes

now run ng serve --open check your project working status

Welcome to Angular 9 with Ivy , the new rendering engine..


Post a Comment

0 Comments