# Angular Directive Generator

| Field | Value |
| --- | --- |
| Content type | [Writing](https://dopamine-prompt.com/en/type/writing) |
| Models | [GPT](https://dopamine-prompt.com/en/model/gpt) |
| License | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) |
| Source | Submitted by [julia\_b](https://dopamine-prompt.com/en/u/dca4eaac-8666-4db5-bcd8-26850221931c) |
| Last updated | 2026-11-26 |

## Prompt

```
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.
```

## Words you can change

The words in brackets in the prompt can be replaced with your own.

- `{description}`: Type your own.
- `[structural | attribute]`: Type your own.
- `[e.g. appHighlight, *appIf]`: Type your own.
- `[list any @Input() properties]`: Type your own.
- `{what_should_happen_to_the_host_element}`: Type your own.

Web page: <https://dopamine-prompt.com/en/prompts/angular-directive-generator>
