# ngClass और ngStyle — एंगुलर

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

> अपने कंपोनेंट से CSS क्लास और इनलाइन स्टाइल को टॉगल करें।

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

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