Angular v17.2 is now available and released on Feb 14, 2024.
While Angular v17.2 is considered a minor release, it still packs some
interesting surprises and improvements:
Key Features:
- Experimental Material 3 Support
below is the Saas code
and below is the component code
- Signal Queries
- A signal is basically a wrapper around a value that can notify users whenever the value changes.
- Signals can contain any type of value, from simple primitives to complex data structures.
- A signal value is always read-only using the getter function, which allows us to track where the signal is used.
@viewChild, @viewchildern decorators, and ngAfterViewInit() life cycle hook are now signal based alternatives
// app.component.ts
and now ngAfterViewInit is replaced by the signal Effect, so now no need for the ngAfterViewInit lifecycle hook, this signal effect will be used in the constructor
import {Component,effect} from '@angular/core' ;
import {RouterOutlet} from '@angular/router' ;
@Component({
selector:'app-root' ,
standalone : true ,
imports : [RouterOutlet ],
templateUrl : './app.component.html' ,
styleUrl : './app.component.css' })
export class
AppComponent {
constructor () {
effect (() => {
console.log("output");
})
}
}
Now we have signal signal-based alternative to ngModel, Simplify template syntax for binding values to DOM inputs like checkboxes and radio buttons.
it introduces the model (this is the new regular API) which we can directly use i template and it will help us in the way data binding
import { Component, effect } from '@angular/core';
import { RouterOutlet } from '@angular/router';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
//templateUrl: './app.component.html',
styleUrl: './app.component.css',
template: `
="checkbox" [(checked)]="isChecked"> Is checked?
`,
})
export class AppComponent {
isChecked : boolean = false;
protected checked = model(false); //this is the new regular API
}
- Netlify Loader: Integrate Angular applications
seamlessly with Netlify's deployment platform.
// angular.json (architect -> build -> options)
"outputHashing": "all",
"sourceMap": true,
"budgets": [
{ "type": "initial", "maximumWarning": "250kb", "maximumError": "300kb" }
],
"ngswConfigPath": "angular.json.ngsw",
"serviceWorker": true,
"optimization": true,
"scripts": [
// ...
"node_modules/@angular/platform-server/dist/esm/platform-server.mjs"
],
"styles": [
// ...
],
"loader": {
"type": "netlify"
}
- Hydration Debugging in DevTools
Other Enhancements:
- Control Vite development server pre-bundling for more granular optimization.
- Configure PostCSS directly within the application builder for tailored styling.
- Various bug fixes and stability improvements across the core framework.
- Angular CLI now supports Bun's package manager for a different build experience.
Remember:
- These features
are mainly experimental and might change in future releases.
- Consider
upgrading to v17.2 for a taste of the future and explore the experimental
functionalities.
------------------------------
EmoticonEmoticon