You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+209Lines changed: 209 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,9 +147,218 @@ You have seen that by using 'resetUpload' property, you can reset the module eas
147
147
- More themes.
148
148
- More customization options.
149
149
150
+
---
151
+
#### For Versions <5.x: [Click Here !](https://github.com/kzrfaisal/angular-file-uploader#for-versions--5x-)
150
152
---
151
153
#### For Versions =<4.0.12:
152
154
- Replace AngularFileUploaderModule and AngularFileUploaderComponent with FileUploadModule and FileUploadComponent respectively.
153
155
---
154
156
#### For Versions <2.x: [Click Here !](https://github.com/kzrfaisal/angular-file-uploader#for-versions--2x-)
155
157
---
158
+
---
159
+
#### For Versions <5.x:
160
+
Angular file uploader is an Angular 2/4/5/6 file uploader modulewith Real-Time Progress Bar, Angular Universal Compatibility and multiple themes which includes Drag and Drop and much more.
| config : object | It's a javascript object. Use this to add custom constraints to the module. All available key-value pairs are given in example 2.For detailed decription refer the table below. | {} |
231
+
| ApiResponse:EventEmitter | It will return the response it gets back from the uploadAPI. Assign one custom function ,for example " DocUpload($event) " here, where " $event " will contain the response from the api. | |
232
+
| resetUpload : boolean | Give it's value as " true " whenever you want to clear the list of uploads being displayed. It's better to assign one boolean variable ('resetVar' here)to it and then change that variable's value. Remember to change 'resetVar' value 'true' to 'false' after every reset. |false|
| multiple : boolean |Set it as " true "for uploading multiple files at a time and as " false "for single file at a time. |false|
238
+
| formatsAllowed : string | Specify the formats of file you want to upload. |'.jpg,.png,.pdf,.docx, .txt,.gif,.jpeg'|
239
+
| maxSize : number | Maximum size limit for files inMB. |20MB|
240
+
|uploadAPI.url: string | Complete api url to which you want to upload. |undefined|
241
+
|uploadAPI.headers: {} | Provide headers you need here. | {} |
242
+
| theme : string | Specify the theme name you want to apply. Available Themes:' dragNDrop ', ' attachPin '| If no theme or wrong theme is specified, default theme will be used instead.|
243
+
| hideProgressBar:boolean |Set it as " true " to hide the Progress bar. |false|
244
+
| hideResetBtn:boolean |Set it as " true " to hide the 'Reset' Button. |false|
245
+
| hideSelectBtn:boolean |Set it as " true " to hide the 'Select File' Button. |false|
246
+
| attachPinText:string | If you are 'attachPin' theme, then you can use it to set custom text. |'Attach supporting documents..'|
247
+
248
+
---
249
+
##### A Better Way to reset the module
250
+
You have seen that by using 'resetUpload' property, you can reset the module easily, however if you need to reset more than one time, there's a better way of doing that( bcoz in 'resetUpload' property, you have to make it as false in order to use it again):-
251
+
252
+
###### Example-3
253
+
```html
254
+
<angular-file-uploader #fileUpload1
255
+
[config]="afuConfig"
256
+
[resetUpload]=resetVar
257
+
(ApiResponse)="DocUpload($event)">
258
+
</angular-file-uploader>
259
+
```
260
+
- Assign one local reference variable (here 'fileUpload1') to the component.
261
+
- Now use this local reference variable in your xyz.component.ts file.
| multiple : boolean | Set it as " true " for uploading multiple files at a time and as " false " for single file at a time. | false |
325
+
| formatsAllowed : string | Specify the formats of file you want to upload. | '.jpg,.png,.pdf,.docx, .txt,.gif,.jpeg' |
326
+
| maxSize : number | Maximum size limit for files in MB. | 20 MB |
327
+
| uploadAPI : string | Complete api url to which you want to upload. | undefined |
328
+
| ApiResponse:EventEmitter | It will return the response it gets back from the uploadAPI. Assign one custom function ,for example " DocUpload($event) " here, where " $event " will contain the response from the api. | |
329
+
| resetUpload : boolean | Give it's value as " true " whenever you want to clear the list of uploads being displayed. It's better to assign one boolean variable ('resetVar' here)to it and then change that variable's value. Remember to change 'resetVar' value 'true' to 'false' after every reset. | false |
330
+
| hideProgressBar : boolean | Set it as " true " to hide the Progress bar. | false |
331
+
332
+
You have seen that by using 'resetUpload' property, you can reset the module easily, however if you need to reset more than one time, there's a better way of doing that( bcoz in 'resetUpload' property, you have to make it as false in order to use it again):-
333
+
334
+
##### Example-3
335
+
```html
336
+
<angular-file-uploader #fileUpload1
337
+
[multiple]="true"
338
+
[formatsAllowed]="'.jpg,.png'"
339
+
[maxSize]="5"
340
+
[uploadAPI]="'https://example-file-upload-api'"
341
+
[resetUpload]=resetVar
342
+
(ApiResponse)="DocUpload($event)"
343
+
[hideProgressBar]="false">
344
+
</angular-file-uploader>
345
+
```
346
+
- Assign one local reference variable (here 'fileUpload1') to the component.
347
+
- Now use this local reference variable in your xyz.component.ts file.
348
+
```javascript
349
+
@ViewChild('fileUpload1')
350
+
private fileUpload1: FileUploadComponent;
351
+
```
352
+
- Remember to import ViewChild and FileUploadComponent properly in your component.
0 commit comments