Angular 9 Is Now Available - What new?

The 9.0.0 release of Angular is here! This release including the framework, Angular Material, and the CLI. This release switches applications to the Ivy compiler and runtime by default, and introduces improved ways of testing components.

This is one of the biggest updates to Angular made in the past 3 years, it empowers developers to build better applications and contribute to the Angular ecosystem.

How to update to version 9


First, update to the latest version of 8
ng update @angular/cli@8 @angular/core@8

Then, update to 9
ng update @angular/cli @angular/core

Ivy

Version 9 moves all applications to use the Ivy compiler and runtime by default.

Ivy compiler and runtime advantages:


  • Smaller bundle sizes
  • Faster testing
  • Better debugging
  • Improved CSS class and style binding
  • Improved type checking
  • Improved build errors
  • Improved build times, enabling AOT on by default
  • Improved Internationalization


Faster testing


Previously, TestBed would recompile all components between the running of each test, regardless of whether there were any changes made to components.

In Ivy, TestBed doesn’t recompile components between tests unless a component has been manually overridden, which allows it to avoid recompilation between the grand majority of tests.

Improved CSS class and style binding

The Ivy compiler and runtime provides improvements for handling styles.

<my-component style="color:red;" [style.color]="myColor" [style]="{color: myOtherColor}" myDirective></div>

@Component({
  host: {
    style: "color:blue"
  },...
})
...

@Directive({
  host: {
    style: "color:black",
    "[style.color]": "property"
  },...
})
...

<div [style.--main-border-color]=" '#CCC' ">
  <p style="border: 1px solid var(--main-border-color)">hi</p>
</div>

Improved type checking

These features will help you and your team catch bugs earlier in the development process.

  • fullTemplateTypeCheck — Activating this flag tells the compiler to check everything within your template (ngIf, ngFor, ng-template, etc)
  • strictTemplates — Activating this flag will apply the strictest Type System rules for type checking.

New components

You can now include capabilities from YouTube and Google Maps in your applications.
  • You can render a YouTube Player inline within your application with the new youtube-player. After you load the YouTube IFrame player API, this component will take advantage of it.
  • We are also introducing google-maps components. These components make it easy to render Google Maps, display markers, and wire up interactivity in a way that works like a normal Angular component, saving you from needing to learn the full Google Maps API.

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation