ng-hub-ui-table
Version:
Highly customizable Angular table and list components with pagination, sorting and filtering support.
46 lines (45 loc) • 1.59 kB
TypeScript
import { OnDestroy, PipeTransform } from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import * as i0 from "@angular/core";
/**
* A standalone pipe that unwraps the value of an observable or returns the value directly if it's not an observable.
*
* @description
* The `UnwrapAsyncPipe` is used to unwrap the value emitted by an observable or return the value directly if it's not an observable.
* It subscribes to the observable and returns the emitted value. If the input is not an observable, it simply returns the value.
*
* @usageNotes
* ```html
* <div>{{ observableOrValue | unwrapAsync }}</div>
* ```
*
* @publicApi
*/
export declare class UnwrapAsyncPipe<T = any> implements PipeTransform, OnDestroy {
#private;
/**
* The unwrapped value of the observable or the direct value.
*/
value: T | null;
/**
* The subscription to the observable.
*/
subscription: Subscription | null;
/**
* Performs cleanup tasks when the pipe is destroyed.
*/
ngOnDestroy(): void;
/**
* Transforms the input value.
*
* @param value The input value to transform. It can be an observable or a direct value.
* @returns The unwrapped value of the observable or the direct value.
*/
transform(value: T | Observable<T>): T | null;
/**
* Unsubscribes from the current subscription.
*/
private unsubscribe;
static ɵfac: i0.ɵɵFactoryDeclaration<UnwrapAsyncPipe<any>, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<UnwrapAsyncPipe<any>, "unwrapAsync", true>;
}