Bird
0
0

Which Angular decorator is used to create a custom structural directive?

easy📝 Conceptual Q2 of 15
Angular - Advanced Patterns
Which Angular decorator is used to create a custom structural directive?
A@Component
B@Pipe
C@Injectable
D@Directive
Step-by-Step Solution
Solution:
  1. Step 1: Identify the decorator for directives

    Angular uses @Directive to define both attribute and structural directives.
  2. Step 2: Exclude other decorators

    @Component is for components, @Injectable for services, and @Pipe for pipes, so they are not correct here.
  3. Final Answer:

    @Directive -> Option D
  4. Quick Check:

    Custom structural directive decorator = @Directive [OK]
Quick Trick: Use @Directive to create any directive, including structural [OK]
Common Mistakes:
  • Using @Component instead of @Directive
  • Confusing with @Injectable or @Pipe
  • Not adding the selector property

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes