# injectGridExport

Angular inject function for programmatic export control.

Uses **lazy grid discovery** - the grid element is found when methods are called,
not during initialization. This ensures it works reliably with:
- Lazy-rendered tabs
- Conditional rendering (*ngIf)
- Dynamic component loading

```ts
injectGridExport(selector: string): ExportMethods
```

## Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| `selector` | <code>string</code> | Optional CSS selector to target a specific grid element.
  Defaults to `'tbw-grid'` (first grid in the component). Use when the
  component contains multiple grids, e.g. `'tbw-grid.primary'` or `'#my-grid'`. |

#### Example

```typescript
import { Component } from '@angular/core';
import { Grid } from '@toolbox-web/grid-angular';
import '@toolbox-web/grid-angular/features/export';
import { injectGridExport } from '@toolbox-web/grid-angular/features/export';

@Component({
  selector: 'app-my-grid',
  imports: [Grid],
  template: `
    <button (click)="handleExport()">Export CSV</button>
    <tbw-grid [rows]="rows" [export]="true"></tbw-grid>
  `
})
export class MyGridComponent {
  gridExport = injectGridExport();

  handleExport() {
    this.gridExport.exportToCsv('employees.csv');
  }
}
```
