@clr/angular
Version:
Angular components for Clarity
33 lines (32 loc) • 1.2 kB
TypeScript
import { OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';
import * as i0 from "@angular/core";
/**
* @description
*
* Developers should explicitly add this service to providers; it then can be injected
* into a constructor and used as a notifier for the `takeUntil` operator. This eliminates
* the need for boilerplates with subscriptions, and we don't need to implement the `OnDestroy`
* interface and teardown subscriptions there.
*
* This can be used as follows:
* ```ts
* @Component({
* selector: 'clr-button-group',
* templateUrl: 'button-group.html',
* providers: [ClrDestroyService],
* })
* export class ClrButtonGroup {
* constructor(public buttonGroupNewService: ButtonInGroupService, private destroy$: ClrDestroyService) {}
*
* ngAfterContentInit() {
* this.buttonGroupNewService.changes.pipe(takeUntil(this.destroy$)).subscribe(button => this.rearrangeButton(button));
* }
* }
* ```
*/
export declare class ClrDestroyService extends Subject<void> implements OnDestroy {
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ClrDestroyService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ClrDestroyService>;
}