1.2.2 • Published 12 months ago

ngx-lifecycle v1.2.2

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

ngx-lifecycle

This library provides output directives for Angular 9+ lifecycle hooks. They can be applied to components and template elements in the following way:

<my-component
  (ngxInit)="log('init')"
  (ngxDestroy)="log('destroy')"
  (ngxChanges)="log('changes', $event)"
  (ngxViewInit)="log('view Init')"
  (ngxViewChecked)="log('view checked')"
  (ngxContentInit)="log('content init')"
  (ngxContentChecked)="log('content checked')"
  (ngxDoCheck)="log('do check')"
>
</my-component>

Usage

Import the NgxLifecycleModule into your application and apply directives to any component or template element as per above.

To listen to ngOnChanges, you need to add an output using both the decorator EmitChanges. This will create an EventEmitter for the respective component or directive.

import { EmitChanges } from 'ngx-lifecycle';

// property can have any name
@Output() @EmitChanges ngxChanges: EventEmitter<SimpleChanges>;
1.2.0

12 months ago

1.2.2

12 months ago

1.2.1

12 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago