Options
All
  • Public
  • Public/Protected
  • All
Menu

ngx-decorate Documentation

Index

Type aliases

ConfEnum

ConfEnum:Pick<PropertyDescriptor, "configurable" | "enumerable">

Functions

CdrProp

  • CdrProp(propName: PropertyKey, conf?: CdrPropConfig): PropertyDecorator
  • Call .markForCheck() on the change detector ref whenever this property is written to.

    Parameters

    • propName: PropertyKey

      Property at which the change detector can be found

    • Optional conf: CdrPropConfig

      Optional configuration

    Returns PropertyDecorator

Complete

  • Complete(): PropertyDecorator
  • Automatically completes the subjects and event emitters at this property. The property can be either a single object or an array of objects.

    Returns PropertyDecorator

LazySubject

  • LazySubject(): MethodDecorator
  • Decorate a getter that returns a subject. The subject will automatically get completed when the component/service/pipe is destroyed.

    Returns MethodDecorator

SubjectSetter

  • Mark the property as a subject setter. When written to, it will call .next(value) on the subject. The decorator's default config option only works on items that make use of the OnInit hook, i.e. it will not work for services and pipes.

    Because the default config option utilises the OnInit hook, it should not be used on properties that are component inputs as the input would get overridden during the hook.

    Parameters

    • subjectPropName: PropertyKey

      Name of the property at which the subject resides

    • Optional conf: SubjectSetterConfig

      Optional configuration

    Returns PropertyDecorator

SubscribeTo

  • Subscribe to an observable and set its last emitted value to this property

    This decorator requires the ngOnInit hook and therefore will only work with directives and components.

    Parameters

    • prop: PropertyKey

      Property at which the observable resides

    • Optional cfg: SubscribeToConfig

      Optional configuration

    Returns PropertyDecorator

TrackDestroyed

  • TrackDestroyed(): PropertyDecorator
  • Set the given property to true when the component is destroyed

    Returns PropertyDecorator

TrackInit

  • TrackInit(): PropertyDecorator
  • Set the given property to true when the component is initialised

    Returns PropertyDecorator

Unsubscribe

  • Unsubscribe(): PropertyDecorator
  • Automatically unsubscribe from the subscription(s) present at this property. The property can be either a single subscription or an array of subscriptions.

    Returns PropertyDecorator