Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

Commit

Permalink
Merge pull request #18 from kyxyes/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
artemnih authored Jun 25, 2018
2 parents d8f90b3 + 0c83a23 commit 7d142cc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/ngx-forms.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
"@angular/router": "^4.4.4",
"bootstrap": "^4.0.0",
"core-js": "^2.4.1",
"lodash": "4.17.10",
"ngx-chips": "^1.9.1",
"ngx-quill": "^3.1.0",
"quill": "^1.3.4",
"reflect-metadata": "^0.1.12",
"lodash": "4.17.10",
"rxjs": "5.5.6",
"zone.js": "^0.8.18"
},
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ import { DynamicFieldService } from "./app/services/dynamic-field.service";
})
export class NgxFormModule { }

export {DynamicFieldService}
export {DynamicFieldService, DataService}

10 changes: 8 additions & 2 deletions src/app/containers/dynamic-form/dynamic-form.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { FormGroup, FormBuilder, Validators, FormArray} from '@angular/forms';

import { FieldConfig } from '../../models/field-config.interface';
import { DataService } from '../../services/data.service';
Expand Down Expand Up @@ -54,9 +54,15 @@ export class DynamicFormComponent implements OnChanges, OnInit {
}
}

/**
* @description create FormGroup and FormControl for all general field, exclude custom field
* @return {FormGroup}
*/
createGroup() {
const group = this.fb.group({});
this.controls.forEach(control => group.addControl(control.name, this.createControl(control)));
this.controls.forEach(control => {
if (!control.custom) group.addControl(control.name, this.createControl(control));
});
return group;
}

Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"emitDecoratorMetadata": true,
"baseUrl": ".",
"allowJs": true,
"outDir": "dist",
"skipLibCheck": true,
"suppressImplicitAnyIndexErrors": true,
"inlineSources": true,
Expand Down

0 comments on commit 7d142cc

Please sign in to comment.