# ngClass और ngStyle — Angular Fundamentals: Components, Signals और Routing

Source: https://www.skillbyai.com/hi/angular/ng-class-style-binding

> ngClass और ngStyle से CSS classes और inline styles को dynamically बदलें।

## कंडीशनल क्लास

`[ngClass]` एक ऑब्जेक्ट लेता है जहाँ की क्लास के नाम हैं और मान तय करते हैं कि वे लागू होंगे या नहीं।

```html
<div [ngClass]="{ active: isActive, disabled: !isEnabled }">
  Card
</div>

<!-- for a single class, plain binding is simpler -->
<div [class.active]="isActive">Card</div>
```

## इनलाइन स्टाइल

`[ngStyle]` एक ऑब्जेक्ट से एक साथ कई CSS प्रॉपर्टी को बाइंड करता है।

```html
<div [ngStyle]="{ color: textColor, 'font-weight': isBold ? 'bold' : 'normal' }">
  Styled text
</div>
```
