DEV Community

Cover image for ⭐ Angular 21 Features ⭐
Sandeep Balachandran
Sandeep Balachandran

Posted on

⭐ Angular 21 Features ⭐

Hey there,

Angular 21 is officially here! Well, not today. Back in November 2025

TL;DR 🙌

✅ Signal Forms (experimental), a new signal-based way to build forms

✅ Zoneless is the default for new apps

✅ Vitest is now the default test runner

✅ Angular Aria: headless, accessible UI components (developer preview)

✅ Angular CLI MCP server for AI-assisted development

✅ HttpClient provided by default

✅ Regular expressions in templates

✅ New migrations: NgClass → [class], NgStyle → [style]

How to update to version 21

Visit angular.dev/update-guide for detailed information and guidance. To have the best update experience,

Update to 21

ng update @angular/cli @angular/core
Enter fullscreen mode Exit fullscreen mode

In order to update your global angular,

npm i -g @angular/cli
Enter fullscreen mode Exit fullscreen mode

🔥 What's in this release?

✅ Signal Forms (Experimental)

  • Forms built on top of Signals
  • Your form model is just a signal
  • Validation is declared in one place, using a schema function

Creating a form

import { Component, signal } from '@angular/core';
import { form, Field, required, email } from '@angular/forms/signals';

@Component({
  selector: 'app-login',
  imports: [Field],
  template: `
    <input type="email" [field]="loginForm.email" />

    @if (loginForm.email().invalid() && loginForm.email().touched()) {
      @for (error of loginForm.email().errors(); track error) {
        <p class="error">{{ error.message }}</p>
      }
    }

    <input type="password" [field]="loginForm.password" />

    <button [disabled]="loginForm().invalid()">Login</button>
  `
})
export class LoginComponent {
  // 👉 the model is a plain signal
  login = signal({ email: '', password: '' });

  // 👉 the form is built from the model, plus validation rules
  loginForm = form(this.login, (path) => {
    required(path.email, { message: 'Email is required' });
    email(path.email, { message: 'Enter a valid email' });
    required(path.password, { message: 'Password is required' });
  });
}
Enter fullscreen mode Exit fullscreen mode

Reading the form state

👉 Every field is a signal, so its state updates automatically

console.log(this.loginForm.email().value());   // current value
console.log(this.loginForm.email().valid());   // true / false
console.log(this.loginForm().invalid());       // whole form

// update the model and the form follows
this.login.set({ email: 'sandy@dev.to', password: '123456' });
Enter fullscreen mode Exit fullscreen mode

✅ Zoneless by default

  • New apps created with ng new no longer include zone.js
  • Change detection is driven by Signals and events
  • Smaller bundles, cleaner stack traces, better performance
// app.config.ts (new projects)
import { ApplicationConfig, provideZonelessChangeDetection } from '@angular/core';

export const appConfig: ApplicationConfig = {
  providers: [
    provideZonelessChangeDetection()
  ]
};
Enter fullscreen mode Exit fullscreen mode

👉 Existing apps keep working with zone.js. You can move to zoneless when you're ready.

✅ Vitest is the default test runner

  • Karma is out, Vitest is in for new projects
  • Faster runs and a modern testing experience
ng test
Enter fullscreen mode Exit fullscreen mode
import { TestBed } from '@angular/core/testing';
import { describe, it, expect, beforeEach } from 'vitest';
import { CounterComponent } from './counter.component';

describe('CounterComponent', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({ imports: [CounterComponent] });
  });

  it('should increment', () => {
    const fixture = TestBed.createComponent(CounterComponent);
    fixture.componentInstance.increment();
    expect(fixture.componentInstance.count()).toBe(1);
  });
});
Enter fullscreen mode Exit fullscreen mode

👉 Migrating existing Jasmine tests (experimental)

ng generate @schematics/angular:refactor-jasmine-vitest
Enter fullscreen mode Exit fullscreen mode

✅ Angular Aria (Developer Preview)

  • A new library of headless components
  • Accessibility, keyboard navigation and focus are handled for you
  • You bring your own styles
  • Includes Accordion, Combobox, Grid, Listbox, Menu, Tabs, Toolbar, Tree and more
npm i @angular/aria
Enter fullscreen mode Exit fullscreen mode
<ul ngListbox [(value)]="selectedFruit">
  <li ngOption value="apple">🍎 Apple</li>
  <li ngOption value="banana">🍌 Banana</li>
  <li ngOption value="mango">🥭 Mango</li>
</ul>
Enter fullscreen mode Exit fullscreen mode

✅ Angular CLI MCP Server

  • Connect AI assistants (Claude, Copilot, Cursor, Gemini…) to your Angular project
  • Gives them up-to-date best practices, docs search, examples and migration tools
ng mcp
Enter fullscreen mode Exit fullscreen mode
{
  "mcpServers": {
    "angular-cli": {
      "command": "npx",
      "args": ["-y", "@angular/cli", "mcp"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

✅ HttpClient provided by default

👉 No more provideHttpClient() just to inject HttpClient

import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Injectable({ providedIn: 'root' })
export class UserService {
  private http = inject(HttpClient); // works out of the box

  getUsers() {
    return this.http.get('/api/users');
  }
}
Enter fullscreen mode Exit fullscreen mode

👉 Still need interceptors or other config? Keep using provideHttpClient(withInterceptors([...])).

✅ Regular expressions in templates

@let isNumeric = /^\d+$/.test(userId());

@if (isNumeric) {
  <user-profile [id]="userId()" />
} @else {
  <p>Invalid user id</p>
}
Enter fullscreen mode Exit fullscreen mode

✅ New migrations

NgClass → class binding

ng generate @angular/core:ngclass-to-class
Enter fullscreen mode Exit fullscreen mode
<!-- Before -->
<div [ngClass]="{ active: isActive, disabled: isDisabled }"></div>

<!-- After -->
<div [class]="{ active: isActive, disabled: isDisabled }"></div>
Enter fullscreen mode Exit fullscreen mode

NgStyle → style binding

ng generate @angular/core:ngstyle-to-style
Enter fullscreen mode Exit fullscreen mode
<!-- Before -->
<div [ngStyle]="{ 'font-size.px': size }"></div>

<!-- After -->
<div [style]="{ 'font-size.px': size }"></div>
Enter fullscreen mode Exit fullscreen mode

For more, let us hear it from the creators Credits : Official Announcement 😄

Changelog: Repository

Top comments (0)