Mahmadmustafa M Kaladagi’s Post

View profile for Mahmadmustafa M Kaladagi, graphic

Senior Software Engineer | Angular (7,9,13,15,16), TypeScript, JavaScript, NgRx Store, SCSS, HTML5

What’s new in Angular 17 Part - 01 Angular 17 is a major release of the Angular framework that brings several new features and enhancements. Some of the key features include: 1. New Control Flow Syntax: Angular 17 introduces a new syntax for control flow in templates. This new syntax is more concise and easier to read than the old syntax, and it is also more familiar to developers who are used to writing JavaScript or TypeScript. 2. Automatic Migration to Built-in Control Flow: Angular 17 will automatically migrate existing templates to use the new control flow syntax. This means that developers will not need to manually update their templates, and they will be able to take advantage of the new syntax without any additional work. 3. Build Performance with ESBuild: Angular 17 uses ESBuild as its default build tool. ESBuild is a JavaScript bundler that is significantly faster than the previous build tool, Webpack. This means that Angular 17 apps will build much faster than previous versions. 4. Enhanced Support for Server-Side Rendering (SSR): Angular 17 includes several enhancements to SSR, including support for pre-rendering components and using SSR with Vite. These enhancements make it easier to use SSR with Angular apps. 5. Deferred Loading: Angular 17 introduces deferred loading, which allows developers to load components lazily. This means that components will only be loaded when they are needed, which can improve the performance of Angular apps. New Syntax for Control Flow in Templates Since its early days, Angular has used structural directives like *ngIf or *ngFor for control flow. Since the control flow needs to be revised anyway to allow for the envisioned fine-grained change detection and for eventually going Zone-less, the Angular team has decided to put it on a new footing. The result is the new build-in control flow, which stands out clearly from the rendered markup: Examples: 1. @for (course of courses; track course.id) { <div class="card"> <h2 class="card-title">{{course.name}}</h2> […] </div> } @empty { <p class="text-lg">No Course found!</p> } 2. @for (group of groups; track $index; let last=$last) { @if (!last) { <span class="mr-5 ml-5">|</span> } } 3. @for (group of groups; track $index; let isLast = $last) { <a >{{group}}</a> @if (!isLast) { <span class="mr-5 ml-5">|</span> } } 4. @switch (mode) { @case ('full') { […] } @case ('small') { […] } @default { […] } } 5. @if (product().discountedPrice && product().discountMinCount) { […] } @else if (product().discountedPrice && !product().discountMinCount) { […] } @else { […] } Automatic Migration to Build-in Control Flow If you would like to automatically migrate your program code to the new control flow syntax, you will now find a schematic for this in the @angular/core package: ng g @angular/core:control-flow --- using this cli command

  • No alternative text description for this image

To view or add a comment, sign in

Explore topics