Ergonomic, robust RxJS Observable inputs for Angular
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.
npm i neo-observable-input
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();
}
}