15.1.0 • Published 9 months ago

@angular-kit/rx-hooks v15.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@angular-kit/rx-hooks

rx-hooks gives you finally reactive lifecycle hooks for Angular.

Installation

Run npm install @angular-kit/rx-hooks to install the library.

Usage

import {RxHooks$} from "@angular-kit/rx-hooks";

@Component({
  // ...
  hostDirectives: [RxHooks$]
})
export class MyComponent {
  hooks$ = inject(RxHooks$)

  constructor() {
      this.hooks$.onInit$.subscribe(() => console.log('onInit'))
      this.hooks$.onDestroy$.subscribe(() => console.log('onDestroy'))
      this.hooks$.onDoCheck$.subscribe(() => console.log('onDoCheck'))
      this.hooks$.onAfterContentInit$.subscribe(() => console.log('onAfterContentInit'))
      this.hooks$.onAfterContentChecked$.subscribe(() => console.log('onAfterContentChecked'))
  }
}

Supported hooks

All hooks except ngOnChanges are supported.

Versioning

The versioning of this library follows the versioning of Angular.