Bird
0
0

What is wrong with this directive usage?

medium📝 Debug Q14 of 15
Angular - Directives
What is wrong with this directive usage?
<div *myDirective>Content</div>

Assuming myDirective is a component, not a structural directive.
AComponents cannot be used with * syntax
BThe directive name is invalid
CThe div tag cannot have directives
DThere is no closing tag
Step-by-Step Solution
Solution:
  1. Step 1: Understand directive vs component usage

    Structural directives use * syntax; components are used as elements, not with *.
  2. Step 2: Check other options

    Directive name can be valid, div can have directives, and closing tag is present.
  3. Final Answer:

    Components cannot be used with * syntax -> Option A
  4. Quick Check:

    * syntax only for structural directives = D [OK]
Quick Trick: Use * only with structural directives, not components [OK]
Common Mistakes:
  • Using * with components
  • Thinking div can't have directives
  • Ignoring correct closing tags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes