Skip to content

pauldraper/neo-observable-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neo observable input

Ergonomic, robust RxJS Observable inputs for Angular

Background

See angular/angular#5689

Similar to https://github.com/Futhark/ngx-observable-input and https://github.com/insidewhy/observable-input and https://github.com/insidewhy/observable-input, but works with type checking Angular inputs, and avoids the tree-shaking problems of decorators.

Install

npm i neo-observable-input

Usage

import { Component, OnChanges } from "@angular/core";
import { ObservableInputs } from "neo-observable-input";

@Component({ template: "" })
export class ExampleComponent implements OnChanges {
  private readonly inputs = new ObservableInputs();

  @Input()
  color: string;
  color$ = this.inputs.observe(() => this.color);

  @Input()
  count: number;
  count$ = this.inputs.observe(() => this.count);

  ngOnChanges() {
    this.inputs.onChanges();
  }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published