Bird
0
0

Which of the following is the correct way to set the default change detection strategy in an Angular component?

easy📝 Syntax Q12 of 15
Angular - Change Detection
Which of the following is the correct way to set the default change detection strategy in an Angular component?
A<code>@Component({ changeDetection: ChangeDetectionStrategy.OnPush })</code>
B<code>@Component({ changeDetection: 'default' })</code>
C<code>@Component({ changeDetection: ChangeDetectionStrategy.Default })</code>
D<code>@Component({ changeDetection: 'Default' })</code>
Step-by-Step Solution
Solution:
  1. Step 1: Recall Angular syntax for change detection

    The changeDetection property expects a value from the ChangeDetectionStrategy enum, not a string.
  2. Step 2: Identify correct enum usage

    ChangeDetectionStrategy.Default is the correct enum value for default strategy.
  3. Final Answer:

    @Component({ changeDetection: ChangeDetectionStrategy.Default }) -> Option C
  4. Quick Check:

    Use enum, not string, for changeDetection [OK]
Quick Trick: Use ChangeDetectionStrategy.Default enum, not string [OK]
Common Mistakes:
MISTAKES
  • Using strings instead of enum values
  • Confusing 'default' with 'Default' string
  • Mixing OnPush with default strategy

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes