Learn about all the new features of Angular 9

Google-driven Java Script has added to its glory yet another framework that is set to embolden the developer’s efforts to create applications. The Angular 9 Beta version was stated to release between the October and November 2019 time frame, but the beta stage has been released and has given a unique tool to improvise further before the actual Angular 9 hits the market.

Do you know what the best part about this successor is? Yes, you guessed it right! Here, Ivy generation compilation and rendering pipeline have become the default feature. Earlier it had to be enforced by the developers but now with Ivy Compiler becoming a default factor, it is all set to make things easier for developers.

Angular and Angular-based applications have become one of the most popular frameworks of Google which has given an all-new meaning to the web, mobile, and desktop applications. It has more than 55,000 stars on Github and has always been under the supervision and scrutiny of Google’s team of community members. The RC version or the release candidate version has all the qualities of making it big.

Let us discover its prime offerings.

Angular Ivy

Many users access web pages from their mobiles even when there is poor connectivity. This could be due to the size of downloadable assets. Developers provide incessant efforts to reduce the size of downloadable assets but it can prove to be an expensive affair. Now with smaller sizes of JavaScript bundles, Ivy is a welcome permanent addition to the family of Angular 9.

Angular based applications built with Ivy will be agile and adept considering Ivy compiler was discretionary in the previous versions. he new Ivy compiler will finally be the default, so Angular apps built with Ivy will be faster and more efficient.tsconfig.json file in the project folder as seen earlier.

Once it had been added, Angular developers had to run the compiler by performing the NGC command in the project folder as given below

node_modules/.bin/ngc

But now in the new version implementing the enable ivy option in the tsconfig.json file, is not required as Ivy renderer has become the default.

Safer than the previous versions

In the previous versions of Angular development, for testing of API’s a function called TestBed.get() had to be provided. After version 8 the intake of string values also ceases. This led to the Angular developer community extricate the safety issue. In this new version now, the team came up with TestBed.inject() and remonstrate the get function.

TestBed.get(ChangeDetectorRef) // any
TestBed.inject(ChangeDetectorRef) // ChangeDetectorRef

With the improvements in TestBed API, the inject function will do what the get does along with being type-safe concurrently.

Module with Providers

Again another enriching feature is the Module with providers that makes immense sense and value to library owners. In the previous versions if you have used ModuleWithProviders then Angular developers would type it stringently or will not type at all. But with the new version Angular developers have to constantly adopt the across-the-board ModuleWithProviders type to display the module type. Initially, the declaration would look like the below-given illustration:

**@NgModule({ …}) export class MyModule { static forRoot(config: SomeConfig): ModuleWithProviders {
return {
ngModule: SomeModule,
providers: [{ provide: SomeConfig, useValue: config }]
};
}
}
**

After the changes, the declaration would look like

@NgModule({ …})
export class MyModule {
static forRoot(config: SomeConfig): ModuleWithProviders
{
return {
ngModule: SomeModule,
providers: [{ provide: SomeConfig, use value: config }]
};
}
}

In the new version, the codebase will be migrated axiomatically after you give the command

Ng update

Advancement in Angular Forms

For prime Angular based applications, the 9th version of Angular has arrived with few form changes. The is not a functional selector now for referencing an Angular form. Now with the new version** **is used. The warning that was given for using removed form tags has been removed in the new version. In this version, you can also utilize FormsModule rather than **FormsModule.withConfig. **

Selector-less Decrees

You will not find this in the Angular 8 Ivy display. The capability to use selector-less directives as base-class is the new feature of Angular 9. It has been added so as to ensure that Angular developers can benefit from Angular compilation.

Internalization

Angular CLI can be utilized to accomplish the standard code which is important to create files for translators. This is done to ensure that publishing in the Angular based application happens in varied languages.

For instance, take into consideration an application with the mentioned HTML title in the English language.

Hello Good morning!

You can add the i18n attribute to mark “Hello Good morning!” as a translatable text. I18b is the short form of internalization here. The addition would appear like:

Hello Good morning!

Once the angular developers have configured Angular based applications you can run the xi18n command to derive localizable text into a file.

You can see a smidgen of generated messages. xlffile below:


Hello Good Morning!

You can then copy the messages.xlf files to the messages.es.xlf file as given below and reframe it to construct the app for Spanish accepting locations along with the translated composition.


Hello Good morning!
¿Hola Buenos Dias?

Dependency Injection changes

Angular Core has some aggressive upgradations that will allure a major chunk of Angular developers. In order to see how Angular 9 adds dependency interjection support for PorvidedIn value, we need to this illustration below:

@Injectable({
providedIn: ‘platform’
})
class MyService {…}

Language service improvements

Thanks to the new version, service support for infused ecosystems like the VS Code and WebStorm has gone a complete rejuvenation. The definition of links with the new version will become more stable. The interpretation of style-based URLs will now be checked-off as template URLs. URLs that do not refer to the actual project file will also be distinguished.

TypeScriptHost enhancements also will be able to make out severity logging by debugging various mistakes and methods. For better testing of scripts a convenience script also has been added to the Angular V9.

Updates of the Angular components

For the CDK, there is an update about Hammer.js, which aids in supplementing gesture support and was essential to use CDK. In the new version, it is optional. If you want to import it you can do so with the given command:

import HammerModule from [@angular/platform-browser]

Parting words

Angular 9 Beta version is a great way to understand it thoroughly and provide preferred changes so that the actual version will come with the updated changes. The feedback gives and takes are going to be the most aggressive during this phase.

#Angular9 #Angular9Features #Angulardevelopment

Learn about all the new features of Angular 9
2.60 GEEK