Skip to content

Commit eed763b

Browse files
committed
readme
1 parent e374ea7 commit eed763b

File tree

1 file changed

+36
-31
lines changed

1 file changed

+36
-31
lines changed

README.md

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ Angular component that allows the creation of dynamic forms. You can use this co
1212
- Full gird layout for forms
1313
- Dummy fields without UI input fields
1414
- You can group fields in same column
15+
- Validation error messages
1516
- Responsive forms
1617
- 👇 Easy to [add more supported fields](#add-more-fields)
1718

19+
#### Supported fields by default
1820

19-
## Installation
21+
> You can add more by yourself!
22+
23+
| Field | Selector / `controlType` | Description |
24+
| ---------- | -------------------------- | ----------- |
25+
| Input | `input` | Text input field.
26+
| Textarea | `textarea` | Textarea field.
2027

21-
### Install via NPM
28+
29+
## Installation
2230

2331
Clone repo and run:
2432

@@ -57,10 +65,10 @@ There are two ways you can use dynamic forms. The first way is if you have no ad
5765
```
5866

5967
```HTML
60-
<app-form-factory
61-
[form]="exampleForm"
62-
[fields]="exampleFields"
63-
></app-form-factory>
68+
<app-form-factory
69+
[form]="exampleForm"
70+
[fields]="exampleFields"
71+
></app-form-factory>
6472
```
6573

6674
#### Example 2
@@ -82,40 +90,37 @@ If you want to insert dynamic fields into one control and add the rest of the fi
8290
```
8391

8492
```HTML
85-
<app-form-factory
86-
[form]="formFactory.getFormGroup(exampleForm,'dynamic')"
87-
[fields]="exampleFields"
88-
></app-form-factory>
93+
<app-form-factory
94+
[form]="formFactory.getFormGroup(exampleForm,'dynamic')"
95+
[fields]="exampleFields"
96+
></app-form-factory>
8997
```
9098

9199
## Available configuration
92100

93-
### Enabling / disabling services
101+
### Enabling / disabling fields
94102

95-
Embed Tool supports some services by default (see above). You can specify services you would like to use:
103+
This system supports some form fields by default (see above). If you want to specify fields you would like to use you can do that in `form-factory/core/services/form-builder.service.ts`:
96104

97-
```javascript
98-
var editor = EditorJS({
99-
...
100-
101-
tools: {
102-
...
103-
embed: {
104-
class: Embed,
105-
config: {
106-
services: {
107-
youtube: true,
108-
coub: true
109-
}
110-
}
105+
```typescript
106+
private formFields: FieldTypeModel[] = [
107+
{
108+
type: 'input',
109+
component: InputComponent,
111110
},
112-
},
113-
114-
...
115-
});
111+
{
112+
type: 'textarea',
113+
component: TextareaComponent,
114+
},
115+
...
116+
];
116117
```
117118

118-
> Note that if you pass services you want to use like in the example above, others will not be enabled.
119+
> Note that if you want you can pass any form field you created like in example above.
120+
121+
> `type` - Selector that you use for `controlType` option in JSON configuration.
122+
123+
> `component` - Angular component
119124
120125
### Add more services
121126

0 commit comments

Comments
 (0)