Bird
0
0

Which of the following is the correct way to create a FormControl with an initial value of 'hello'?

easy📝 Syntax Q12 of 15
Angular - Reactive Forms
Which of the following is the correct way to create a FormControl with an initial value of 'hello'?
Anew FormControl('hello')
BFormControl('hello')
Cnew FormControl = 'hello'
DFormControl.create('hello')
Step-by-Step Solution
Solution:
  1. Step 1: Recall FormControl instantiation syntax

    In Angular, FormControl is created by calling new FormControl(initialValue).
  2. Step 2: Check each option

    new FormControl('hello') uses the correct constructor syntax. Options A, B, and D are invalid or incorrect syntax.
  3. Final Answer:

    new FormControl('hello') -> Option A
  4. Quick Check:

    Use new keyword with FormControl constructor [OK]
Quick Trick: Use new FormControl(value) to create a control [OK]
Common Mistakes:
MISTAKES
  • Omitting new keyword
  • Using assignment instead of constructor
  • Calling non-existent create method

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes