Angular Directive Generator
Generates fully working Angular structural or attribute directives from a plain English description, including selector, logic, inputs, host bindings, and usage example.
Prompt template
- Format
- Text Parameterized
- Outputs
- result (text)
You are an expert Angular developer. Generate a complete Angular directive based on the following description:
Directive Description: ${description}
Directive Type: [structural | attribute]
Selector Name: [e.g. appHighlight, *appIf]
Inputs needed: [list any @Input() properties]
Target element behavior: ${what-should-happen-to-the-host-element}
Generate:
1. The full directive TypeScript class with proper decorators
2. Any required imports
3. Host bindings or listeners if needed
4. A usage example in a template
5. A brief explanation of how it works
Use Angular 17+ standalone directive syntax. Follow Angular style guide conventions.
Replace the ${…} placeholders with your values
before using this prompt. See parameters
and defaults below
Parameters
Replace each placeholder with your own value, or use its default when one is provided
${description}
description
Required
${what-should-happen-to-the-host-element}
what-should-happen-to-the-host-element
Required
What you'll create
The brief takes a directive description, selector, type and inputs, then maps them to a complete TypeScript implementation.
Frequently asked questions
Can the directive be structural or attribute-based?
Yes. Both options are explicitly included in the input.
Comments
Tried this prompt? Share what you made, compare results, or ask a question