Bird
0
0

Which of the following is the correct syntax to apply a directive in Angular?

easy📝 Syntax Q12 of 15
Angular - Directives
Which of the following is the correct syntax to apply a directive in Angular?
A
B
C
D
Step-by-Step Solution
Solution:
  1. Step 1: Identify Angular directive syntax

    Structural directives use the asterisk (*) before the directive name to modify the DOM structure.
  2. Step 2: Check other symbols

    # is for template references, ? and @ are invalid for directives.
  3. Final Answer:

    <div *myDirective></div> -> Option C
  4. Quick Check:

    Structural directives use * prefix = A [OK]
Quick Trick: Look for * before directive name for structural directives [OK]
Common Mistakes:
  • Using # which is for template references
  • Using ? or @ which are invalid syntax
  • Omitting the * for structural directives

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes