ngx-decorate
Version:
Useful decorators for Angular 2 and above
20 lines (19 loc) • 902 B
TypeScript
import { ConfEnum } from './type/ConfEnum';
export interface SubjectSetterConfig {
/** Default value to set on the prototype */
default?: any;
/** Partial property descriptor */
desc?: ConfEnum;
}
/**
* Mark the property as a subject setter. When written to, it will call .next(value) on the subject.
* The decorator's <b>default</b> config option only works on items that make use of the OnInit hook,
* i.e. it will <b>not</b> work for services and pipes.
*
* Because the <b>default</b> 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.
*
* @param subjectPropName Name of the property at which the subject resides
* @param conf Optional configuration
*/
export declare function SubjectSetter(subjectPropName: PropertyKey, conf?: SubjectSetterConfig): PropertyDecorator;