Bird
0
0

What does the OnPush change detection strategy do in Angular?

easy📝 Conceptual Q11 of 15
Angular - Performance Optimization
What does the OnPush change detection strategy do in Angular?
AIt disables change detection completely.
BIt checks for changes only when input properties change or events occur.
CIt forces Angular to check for changes on every event regardless of inputs.
DIt updates the component only when manually triggered by the developer.
Step-by-Step Solution
Solution:
  1. Step 1: Understand OnPush behavior

    OnPush strategy tells Angular to run change detection only when input properties change or events happen inside the component.
  2. Step 2: Compare with other options

    Options A, C, and D describe behaviors that are not how OnPush works. It does not disable detection, nor does it check on every event or require manual triggers.
  3. Final Answer:

    It checks for changes only when input properties change or events occur. -> Option B
  4. Quick Check:

    OnPush triggers on input or event changes = B [OK]
Quick Trick: OnPush triggers only on input or event changes [OK]
Common Mistakes:
  • Thinking OnPush disables change detection
  • Believing OnPush checks on every event
  • Assuming manual triggers are required

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes