Skip to content

API Reference


API Reference / @dasch-ng/decorators / Observe

Function: Observe() ​

Observe<T>(observedKey): PropertyDecorator

Defined in: observe.ts:20

@Observe is a decorator that allows to subscribe to the stream of changes of another property. It can be used for @Input properties, but not necessarily.

Type Parameters ​

T ​

T

Parameters ​

observedKey ​

string

Key of the property to observe.

Returns ​

PropertyDecorator

Example ​

ts
@Component({
  selector: 'some-component',
  template: '<span>{{ foo$ | async }}</span>'
})
export class SomeComponent {
  @Input() foo: number;
  @Observe('foo') foo$: Observable<number>;
}

Released under the MIT License.