Skip to content

Commit

Permalink
Merge 25c2a70 into 9c1b77b
Browse files Browse the repository at this point in the history
  • Loading branch information
edetec committed Aug 21, 2018
2 parents 9c1b77b + 25c2a70 commit 44a5948
Show file tree
Hide file tree
Showing 20 changed files with 357 additions and 172 deletions.
38 changes: 38 additions & 0 deletions README.md
Expand Up @@ -256,6 +256,44 @@ export class HomeComponent implements OnInit {
}
}
```
### Custom Field

It's possible to create your own field template and set it on dynamic field list through CustomField

Example:
`my-component.html`
```html
<ng-template #customField let-customControl="control" let-isEditing="isEditing">
<div class="input-group">
<div class="input-group-addon">$</div>
<input type="number"
[formControl]="customControl"
[attr.disabled]="!isEditing || null"
class="form-control"
style="text-align:right"
id="exampleInputAmount"
placeholder="Amount" />
<div class="input-group-addon">.00</div>
</div>
</ng-template>
```

`my-component.ts`
```ts

@ViewChild('customField') customFieldTmpl: TemplateRef<any>;
public fields: DynamicField[];
...
ngOnInit() {
this.fields = [
new CustomField({
key: 'custom_amount',
label: 'Custom Field Amount',
tmpl: this.customFieldTmpl
}),
];
}
```

### Typed key validation

Expand Down
212 changes: 137 additions & 75 deletions demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 44a5948

Please sign in to comment.