Bird
0
0

Given this Angular pipe usage:

medium📝 Predict Output Q4 of 15
Angular - Pipes
Given this Angular pipe usage:
items = [1, 2, 3];
// Template: {{ items | customPipe }}

If customPipe is pure, when will it run again after initial render?
ANever after the initial render.
BOn every change detection cycle.
CWhenever any property inside items changes.
DOnly if the items array reference changes.
Step-by-Step Solution
Solution:
  1. Step 1: Understand pure pipe trigger

    Pure pipes run only when the input reference changes, not on internal mutations.
  2. Step 2: Analyze options

    Only if the items array reference changes. correctly states it runs only if the array reference changes; others are incorrect.
  3. Final Answer:

    Only if the items array reference changes. -> Option D
  4. Quick Check:

    Pure pipe runs on input reference change [OK]
Quick Trick: Pure pipes run only on input reference changes [OK]
Common Mistakes:
  • Thinking pure pipes detect internal array changes
  • Assuming pure pipes run every cycle
  • Believing pure pipes never run again

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes