Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Explain the role of the Angular ngClass directive.
Answer: The ngClass directive in Angular is used to conditionally apply CSS classes to an element. It allows you to dynamically set classes based on expressions or conditions in the component.

Example:

This div has dynamic classes
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook