@webdev-tools/ng-nested-reactive-forms
Version:
Implement Nested FormControl for Angular Reactive Forms.
40 lines (39 loc) • 1.83 kB
TypeScript
import { OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
import { FormArray, FormControl, FormGroup } from '@angular/forms';
import { ReplaySubject } from 'rxjs/internal/ReplaySubject';
import { NrfFormDirective } from '../form/form.directive';
import { NrfFormService } from '../form/form.service';
import { NrfControlOptions } from './control-options.component';
import { NrfFormHierarchyService } from './services/form-hierarchy.service';
import { NrfModelSetterService } from './services/model-setter.service';
export declare class NrfNestedControlDirective implements OnInit, OnDestroy {
private readonly modelSetter;
private readonly templateRef;
private readonly viewContainerRef;
private readonly formHierarchy;
isDestroyed: boolean;
parentFormGroup: FormGroup | FormArray;
formControl: FormControl;
modelPath: string;
private modelPieces;
controlName: string;
private readonly formOrService;
constructor(modelSetter: NrfModelSetterService, templateRef: TemplateRef<any>, viewContainerRef: ViewContainerRef, nrfForm: NrfFormDirective, nrfFormService: NrfFormService, formHierarchy: NrfFormHierarchyService);
nrfModelName: string;
controlOptions: NrfControlOptions;
readonly ready$: ReplaySubject<{}>;
ngOnInit(): void;
ngOnDestroy(): void;
private removeFromParentFormGroup;
private getModelPathWithoutFirstPart;
private getControlName;
protected getNewFormControl(): FormControl;
protected getInitialValue(): any | null;
private showViewContent;
private registerToFormGroup;
private getParentFormGroup;
protected getFormControl(): FormControl;
private subscribeToUpdateEntityValue;
setModelValue(newValue: any): void;
emitReadyState(): void;
}