Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 1x 7x 7x 7x 7x 1x 1x | import { AfterViewInit, Directive, ViewChild, ViewContainerRef } from '@angular/core';
import { DynamicFormValidationService } from '../dynamic-form-validation/dynamic-form-validation.service';
import { DynamicFormField } from './dynamic-form-field';
import { DynamicFormFieldBase } from './dynamic-form-field-base';
import { DynamicFormFieldControl } from './dynamic-form-field-control';
import { DynamicFormFieldDefinition } from './dynamic-form-field-definition';
import { DynamicFormFieldTemplate } from './dynamic-form-field-template';
@Directive()
export abstract class DynamicFormFieldWrapperBase<
Value = any, Model extends Value = Value,
Control extends DynamicFormFieldControl<Value> = DynamicFormFieldControl<Value>,
Template extends DynamicFormFieldTemplate = DynamicFormFieldTemplate,
Definition extends DynamicFormFieldDefinition<Value, Template> = DynamicFormFieldDefinition<Value, Template>,
Field extends DynamicFormField<Value, Model, Control, Template, Definition> =
DynamicFormField<Value, Model, Control, Template, Definition>
> extends DynamicFormFieldBase<Value, Model, Control, Template, Definition, Field> implements AfterViewInit {
component: DynamicFormFieldBase<Value, Model, Control, Template, Definition, Field>;
@ViewChild('container', { read: ViewContainerRef, static: true })
container: ViewContainerRef;
constructor(
protected containerRef: ViewContainerRef,
protected override validationService: DynamicFormValidationService,
) {
super(validationService);
}
get ref(): ViewContainerRef { return this.containerRef; }
ngAfterViewInit(): void {
const viewRef = this.containerRef.detach(0);
this.container.insert(viewRef);
}
}
|