|
@@ -2,7 +2,7 @@ import {
|
|
|
Directive, ComponentFactoryResolver, ComponentRef, ViewContainerRef,
|
|
|
Input, Output, EventEmitter, OnInit, SkipSelf
|
|
|
} from '@angular/core';
|
|
|
-import { Form, FormControl, ControlContainer, NgControl, ControlValueAccessor, ValidatorFn, AsyncValidatorFn } from '@angular/forms';
|
|
|
+import { Form, FormControl, ControlContainer, NgControl, ControlValueAccessor, ValidatorFn, AsyncValidatorFn, AbstractFormGroupDirective } from '@angular/forms';
|
|
|
|
|
|
import * as formFieldComponents from './../components';
|
|
|
|
|
@@ -66,7 +66,11 @@ export class DynafieldDirective extends NgControl implements OnInit {
|
|
|
const el = this.component.location.nativeElement;
|
|
|
el.classList.add(type.toLowerCase().replace('component', ''));
|
|
|
|
|
|
+ // Support the recursive insertion of Dynaform components
|
|
|
if (type === 'DynaformComponent') {
|
|
|
+ if (meta.template) {
|
|
|
+ (<any>instance).template = meta.template;
|
|
|
+ }
|
|
|
meta = meta.meta;
|
|
|
}
|
|
|
|
|
@@ -92,7 +96,7 @@ export class DynafieldDirective extends NgControl implements OnInit {
|
|
|
// so we need to wire it up!
|
|
|
this.name = name;
|
|
|
this.valueAccessor = <FFCCustom>this.component.instance;
|
|
|
- this._control = this.formDirective.addControl(this);
|
|
|
+ this._control = this.formGroupDirective.addControl(this);
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.error('ERROR INSTANTIATING DYNAFORM CHILD COMPONENT', type);
|
|
@@ -104,7 +108,7 @@ export class DynafieldDirective extends NgControl implements OnInit {
|
|
|
return [...this.cc.path, this.name];
|
|
|
}
|
|
|
|
|
|
- get formDirective(): Form | null {
|
|
|
+ get formGroupDirective(): Form | null {
|
|
|
return this.cc ? this.cc.formDirective : null;
|
|
|
}
|
|
|
|