@crnk/angular-ngrx
Version:
Angular helper library for ngrx-json-api and crnk:
30 lines (29 loc) • 1.68 kB
TypeScript
import { EventEmitter, OnChanges, OnDestroy } from '@angular/core';
import { AsyncValidatorFn, ControlContainer, ControlValueAccessor, Validator, ValidatorFn } from '@angular/forms';
import { Path } from '../crnk.expression';
import { CrnkControl } from './crnk.expression.form.model.base';
/**
* Allows to bind expressions of type {link Expression} to expectForm controls. The directive is very similar to
* NgModel, but allows to bind an expression instead of a generic object. The advantage is that an expression
* can hold both
*/
export declare class FormExpressionDirective extends CrnkControl implements OnChanges, OnDestroy {
pathModel: Path<any>;
name: string;
arbFormExpressionChange: EventEmitter<{}>;
/**
* NOTE that in contract to NgModel we do not use @Host for parent. This would enforce that the
* components are direct children of the forms component. TODO investigate whether there is
* any better solutions (maybe something similar to FormGroup). It does not seem like it is possible
* to expose an existing ControlContainer again with @Component.providers as it would lead to a circular
* dependency (there is no provider for children only, but itself as well).
*/
constructor(parent: ControlContainer, validators: Array<Validator | ValidatorFn>, asyncValidators: Array<Validator | AsyncValidatorFn>, valueAccessors: ControlValueAccessor[]);
ngOnDestroy(): void;
readonly path: string[];
readonly formDirective: any;
viewToModelUpdate(newValue: any): void;
protected _setUpControl(): void;
private _checkForErrors();
private _checkParentType();
}