@angular-kit/rx-hooks
TypeScript icon, indicating that this package has built-in type declarations

15.1.1 • Public • Published

@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.

Package Sidebar

Install

npm i @angular-kit/rx-hooks

Weekly Downloads

2

Version

15.1.1

License

MIT

Unpacked Size

44.8 kB

Total Files

9

Last publish

Collaborators

  • mikelgo