ngx-subscribe
Version:
Subscribe decorator to be used in Angular 2+ components, it will automatically subscribe and cleanup observables to component properties.
14 lines (13 loc) • 539 B
TypeScript
import { ChangeDetectorRef } from '@angular/core';
/**
* Describes expected component interface when it uses Subscribe decorators.
*/
export interface WithSubscriptions {
changeDetector: ChangeDetectorRef;
}
/**
* Will define property which will subscribe to the given Observable on set and will return last emited value on get.
*
* @param defaultValue Default value which will be used till observable will emit its value for the first time.
*/
export declare function Subscribe(defaultValue?: Function | any): any;