liveBook · Manning

Zoneless application

As explained in Modern Angular

A zoneless application is an Angular application that performs reactivity and view updates without relying on zone.js to detect asynchronous task completion.

A zoneless application updates views through signal-driven reactivity rather than relying on Zone.js to notice asynchronous work. The proposed model makes components signal-based: their inputs are signals, and they are checked when their signal properties change. This replaces broad, implicit update behavior with an explicit reactive model. section 10.3.4

A signal-based component is proposed to behave differently from a Zone.js-based component:

Going fully zoneless means marking every component as signal-based, allowing Zone.js to be removed. Migration can be incremental: zone-based and signal-based components can coexist, but Zone.js must remain while any zone-based component is present. This makes compatibility a practical constraint rather than an all-or-nothing rewrite. section 10.3.4

Signal input for project details

A project-details component can replace an `@Input` plus `ngOnChanges` with a required signal input. Converting that input to an observable, switching to the requested project, and converting the result back to a signal makes the displayed project reactive to `id` changes. section 10.3.4

Listing 10.18 Hypothetical signal-based component with model bindings
@Component({
  selector: 'app-root',
  standalone: true,
  template: `
    <div>
      <input placeholder="Search for product..." [(ngModel)]="query"/>  #1
      <ul>
        @for (product of filteredProducts(); track product.id) {
          <li>
            {{product.name}}
          </li>
        }
      </ul>
    </div>
  `,
})
export class App {
  private readonly productService = inject(ProductService); 
  type = input<number>();  #2
  query = signal('');
  allProducts = computed(() => this.productService.getProductsByType(this.type()));  #3
  filteredProducts = computed(() => {
    return this.allProducts.filter(product => product.name.includes(this.query()))  #4
  });
}

This hypothetical product search component combines a signal-backed query with computed product lists, illustrating the reactive style intended for signal-based components. section 10.3.4

Zoneless applications remain in an experimental developer-preview direction. Adopt the approach as a modernization path toward granular, signal-triggered updates, while planning coexistence with existing Zone.js-based components. section 10.0 section 10.3.4

How Modern Angular covers it

How deep it goes
Explains proposed component behavior and migration constraints, while deferring the details of view-based detection.
Examples
Uses a ProjectDetails signal-input conversion and a hypothetical computed product-search component.
What it assumes
Assumes familiarity with signals and introduces the proposed behavior of signal-based components.
What you can do after
Apply it via Angular signal-based components while retaining Zone.js during mixed-component migration.
How it connects
Connects zoneless applications to signals, signal inputs, computed signals, Zone.js, and change detection.

This explainer was generated by Manning's knowledge graph from the text of Modern Angular. The section links point to the parts of the book it draws on.