NG.VIII · Angular 22 practice question

A developer authors this standalone component in Angular 22 without setting a changeDetection property in the @Component decorator. Which change detection strategy does Angular apply?

import { Component, input } from '@angular/core';

@Component({
  selector: 'app-badge',
  template: `<span>{{ label() }}</span>`,
})
export class BadgeComponent {
  label = input.required<string>();
}
Choose one answer
Check answer and explanation

Correct answer: OnPush

Explanation

Starting in Angular v22, OnPush is the default change detection strategy when a component omits an explicit changeDetection setting.

Common trap

Developers used to Angular v21 and earlier often expect CheckAlways (Default) when changeDetection is omitted, but Angular v22 switched the default to OnPush. Detached is not a built-in default strategy in @Component and would prevent automatic updates unless manually reattached.

Source: Angular docs: Skipping component subtrees — Using `OnPush`
Checked against the cited text on 2026-11-25.

Report an error in this question