|
@@ -2,7 +2,9 @@ import { Component, OnInit, OnChanges, ViewChild, TemplateRef } from '@angular/c
|
|
|
import { FormGroup } from '@angular/forms';
|
|
|
import { DynaformService } from './dynaform/services/dynaform.service';
|
|
|
|
|
|
-import { model, meta as lazyMeta } from './_mock/testfields.v6';
|
|
|
+import * as test2 from './_mock/testfields.v2';
|
|
|
+import * as test5 from './_mock/testfields.v5';
|
|
|
+import * as test6 from './_mock/testfields.v6';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-root',
|
|
@@ -23,9 +25,35 @@ export class AppComponent implements OnInit, OnChanges {
|
|
|
}
|
|
|
|
|
|
ngOnInit() {
|
|
|
- ({ form: this.form, meta: this.meta } = this.dynaform.build(model, lazyMeta));
|
|
|
+
|
|
|
+ const testcase: number = 5;
|
|
|
+
|
|
|
+ console.log('%c *** TEST DATA *** ', 'color: white; background-color: green; font-weight: bold;');
|
|
|
+ switch (testcase) {
|
|
|
+ case 1:
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ // Test 2 - Build a FormGroup form metadata
|
|
|
+ console.log(test2);
|
|
|
+ this.form = this.dynaform.buildFormGroup(test2.meta);
|
|
|
+ this.meta = test2.meta;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ // Test 5 - Deeply nested FormGroups
|
|
|
+ console.log(test5);
|
|
|
+ ({ form: this.form, meta: this.meta } = this.dynaform.build(test5.model, test5.meta));
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ // Test 6 - Validation
|
|
|
+ console.log(test6);
|
|
|
+ ({ form: this.form, meta: this.meta } = this.dynaform.build(test6.model, test6.meta));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ console.log('%c *** FormGroup *** ', 'color: white; background-color: green; font-weight: bold;');
|
|
|
console.dir(this.form);
|
|
|
+ console.log('%c *** MetaData *** ', 'color: white; background-color: green; font-weight: bold;');
|
|
|
console.dir(this.meta);
|
|
|
+ console.log('*******************************');
|
|
|
}
|
|
|
|
|
|
ngOnChanges() {
|