Suggest an editImprove this articleRefine the answer for “What does ngClass do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)The `[ngClass]` directive in Angular is an **attribute directive** that lets you **dynamically add or remove CSS classes** on an element based on expressions or conditions. **Key point:** `ngClass` lets you control styles through classes dynamically, without directly modifying the DOM or styles via `Renderer2`.Shown above the full answer for quick recall.Answer (EN)ImageThe `[ngClass]` directive in Angular is an **attribute directive** that lets you **dynamically add or remove CSS classes** on an element based on expressions or conditions. How it works: 1. `[ngClass]` accepts a string, an array or an object: - **String**: one or more class names separated by spaces. - **Array**: a list of classes. - **Object**: key - the class name, value - a boolean expression. Examples: ```html <!-- String --> <div [ngClass]="'class1 class2'">Text</div> <!-- Array --> <div [ngClass]="['class1', 'class2']">Text</div> <!-- Object --> <div [ngClass]="{'active': isActive, 'highlight': isHighlighted}"> Text </div> ``` > Conclusion: `ngClass` lets you **control styles through classes dynamically**, without directly modifying the DOM or styles via `Renderer2`.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.