Last active
July 3, 2019 07:13
-
-
Save harishrathi/f2c122ebf7c3e0f35f5f3afede786fd9 to your computer and use it in GitHub Desktop.
angular-file-upload-control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form [formGroup]="form"> | |
<formly-form [model]="model" [fields]="fields" [form]="form"></formly-form> | |
</form> | |
<pre>{{model | json}}</pre> | |
<pre>invalid: {{form.invalid}}</pre> | |
<pre>errors: {{form.errors | json}}</pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FormGroup } from '@angular/forms'; | |
import { FormlyFieldConfig } from '@ngx-formly/core'; | |
public form = new FormGroup({}); | |
public model: any = {}; | |
public fields: FormlyFieldConfig[] = [ | |
{ | |
key: 'file', | |
type: 'file', | |
templateOptions: { | |
label: 'File Name', | |
placeholder: 'Select File', | |
accept: 'image/jpeg', | |
appearance: 'outline', | |
// required: true // , | |
// maxSize: 900 | |
} | |
}, | |
{ | |
key: 'text', | |
type: 'input', | |
templateOptions: { | |
type: 'text', | |
appearance: 'outline' | |
} | |
}, | |
{ | |
key: 'date', | |
type: 'datepicker', | |
templateOptions: { | |
appearance: 'outline', | |
label: 'File Date', | |
placeholder: 'select date', | |
required: true, | |
minDate: '2019-01-01', | |
maxDate: '2019-12-31' | |
} | |
} | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment