Bird
0
0

What is the main error in this Angular template snippet?

medium📝 Debug Q14 of 15
Angular - Templates and Data Binding
What is the main error in this Angular template snippet?
<input (ngModel)="email">
AngModel cannot be used on input elements
BMissing square brackets for two-way binding syntax
CFormsModule is not imported
DParentheses should be replaced with curly braces
Step-by-Step Solution
Solution:
  1. Step 1: Identify ngModel syntax error

    The snippet uses only parentheses (event binding) instead of two-way binding syntax [(ngModel)].
  2. Step 2: Check other options

    ngModel is valid on input, FormsModule import is not shown but not guaranteed error here, and curly braces are not used for binding syntax.
  3. Final Answer:

    Missing square brackets for two-way binding syntax -> Option B
  4. Quick Check:

    Two-way binding needs [( )] brackets [OK]
Quick Trick: Two-way binding always uses [(ngModel)] [OK]
Common Mistakes:
  • Using (ngModel) instead of [(ngModel)]
  • Forgetting to import FormsModule
  • Confusing event binding with two-way binding

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes