Skip to content

Instantly share code, notes, and snippets.

@tomastrajan
Created October 20, 2022 21:38
Show Gist options
  • Select an option

  • Save tomastrajan/f5a8b36ac9a02bdebedf66f9eea656e8 to your computer and use it in GitHub Desktop.

Select an option

Save tomastrajan/f5a8b36ac9a02bdebedf66f9eea656e8 to your computer and use it in GitHub Desktop.

Revisions

  1. tomastrajan created this gist Oct 20, 2022.
    16 changes: 16 additions & 0 deletions some.component.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    @Component({ /* ... */ })
    export class SomeComponent {

    // streamifies input
    @Input$() prop: Observable<string>;

    // lifecycle notifier as an Observable stream
    @OnDestroy$() destroy$: Obseravble<void>;

    // lifecycle hook as decorator instead of implements interface
    @OnInit()
    init() { // could be any method name when used with decorator

    }

    }