### File

`src/lib/expand-row/expand-row.service.ts`

### Index

###### Properties
Public expandedRow
###### Methods
Public isExpanded Public isExpanded$ Public toggleRow

### Methods

Public isExpanded
`isExpanded(row: Data)`
Defined in src/lib/expand-row/expand-row.service.ts:18
Parameters :
Name | Type | Optional
row | `Data` | No
Returns : `boolean`

Public isExpanded$
`isExpanded$(row: Data)`
Defined in src/lib/expand-row/expand-row.service.ts:22
Parameters :
Name | Type | Optional
row | `Data` | No
Returns : `Observable<boolean>`

Public toggleRow
`toggleRow(row: Data)`
Defined in src/lib/expand-row/expand-row.service.ts:10
Parameters :
Name | Type | Optional
row | `Data` | No
Returns : `void`

### Properties

Public expandedRow
Default value : `new BehaviorSubject<Data | null>(null)`
Defined in src/lib/expand-row/expand-row.service.ts:8

    import { Injectable } from '@angular/core';
    import type { Observable } from 'rxjs';
    import { BehaviorSubject } from 'rxjs';
    import { map } from 'rxjs/operators';

    @Injectable()
    export class ExpandRowService<Data extends Record<string, any>> {
      public expandedRow = new BehaviorSubject<Data | null>(null);

      public toggleRow(row: Data): void {
        if (this.expandedRow.value === row) {
          this.expandedRow.next(null);
        } else {
          this.expandedRow.next(row);
        }
      }

      public isExpanded(row: Data) {
        return this.expandedRow.value === row;
      }

      public isExpanded$(row: Data): Observable<boolean> {
        return this.expandedRow.pipe(map((expandedRow) => expandedRow === row));
      }
    }

# results matching ""

# No results matching ""