# Directive

An instruction attached to an element that changes how it looks or behaves.

## What is **Directive**?

A **directive** is an instruction you attach to an element to change how it looks or behaves. Components are directives with a template; attribute directives like `ngClass` change an existing element.

```html
<div [ngClass]="{ highlighted: isSelected }">...</div>
```

Level: Apprentice · [More Angular terms at this level](https://www.ask-codey.com/glossary?category=angular&level=2)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/directive
