Skip to content

Commit 3ef87f9

Browse files
ng 9 package published (#76)
Co-authored-by: Faisal Ansari <faisal@heyhearth.com>
1 parent 8828843 commit 3ef87f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+13301
-9445
lines changed

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Editor configuration, see http://editorconfig.org
1+
# Editor configuration, see https://editorconfig.org
22
root = true
33

44
[*]
@@ -8,6 +8,9 @@ indent_size = 2
88
insert_final_newline = true
99
trim_trailing_whitespace = true
1010

11+
[*.ts]
12+
quote_type = single
13+
1114
[*.md]
1215
max_line_length = off
1316
trim_trailing_whitespace = false

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44
/dist
55
/tmp
66
/out-tsc
7+
# Only exists if Bazel was run
8+
/bazel-out
79

810
# dependencies
911
/node_modules
1012

13+
# profiling files
14+
chrome-profiler-events*.json
15+
speed-measure-plugin*.json
16+
1117
# IDEs and editors
1218
/.idea
1319
.project
@@ -23,6 +29,7 @@
2329
!.vscode/tasks.json
2430
!.vscode/launch.json
2531
!.vscode/extensions.json
32+
.history/*
2633

2734
# misc
2835
/.sass-cache

Future Updates.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 165 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Angular file uploader is an Angular 2/4/5/6/7/8 file uploader module with Real-Time Progress Bar, Angular Universal Compatibility and multiple themes which includes Drag and Drop and much more.
1+
2+
Angular file uploader supports angular versions 2.x - 9.x and comes with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility and multiple themes which includes Drag and Drop and much more.
23

34
### Demo
45
<https://kzrfaisal.github.io/#/afu>
@@ -71,8 +72,9 @@ npm i angular-file-uploader
7172
dragNDropBox: 'Drag N Drop',
7273
attachPinBtn: 'Attach Files...',
7374
afterUploadMsg_success: 'Successfully Uploaded !',
74-
afterUploadMsg_error: 'Upload Failed !'
75-
};
75+
afterUploadMsg_error: 'Upload Failed !',
76+
sizeLimit: 'Size Limit'
77+
}
7678
};
7779
```
7880

@@ -127,9 +129,9 @@ You have seen that by using 'resetUpload' property, you can reset the module eas
127129
to reset the module hassle-free anytime.
128130
129131
### Styling:
130-
###### Following classes are available for customisation :
131-
###### *Include them in your global css class (src/styles.css)*
132-
###### *Use '!important' if something doesn't works*
132+
##### Following classes are available for customisation :
133+
##### *Include them in your global css class (src/styles.css)*
134+
##### *Use '!important' if something doesn't works*
133135
- .afu-select-btn {}
134136
- .afu-reset-btn {}
135137
- .afu-upload-btn {}
@@ -142,13 +144,15 @@ You have seen that by using 'resetUpload' property, you can reset the module eas
142144
- .afu-upload-status {}
143145
- .afu-attach-pin {}
144146

145-
##### Points to note:
147+
#### Points to note:
146148
- Files are uploaded in FormData format.
147149

148150
### Coming Soon:
149151
- More themes.
150152
- More customization options.
151-
153+
---
154+
#### For Versions < 6.x : [Click Here !](https://github.com/kzrfaisal/angular-file-uploader#for-versions--6x-)
155+
---
152156
---
153157
#### For Versions < 5.x : [Click Here !](https://github.com/kzrfaisal/angular-file-uploader#for-versions--5x-)
154158
---
@@ -158,6 +162,159 @@ You have seen that by using 'resetUpload' property, you can reset the module eas
158162
#### For Versions < 2.x : [Click Here !](https://github.com/kzrfaisal/angular-file-uploader#for-versions--2x-)
159163
---
160164
---
165+
#### For Versions < 6.x :
166+
Angular file uploader is an Angular 2/4/5/6 file uploader module with Real-Time Progress Bar, Angular Universal Compatibility and multiple themes which includes Drag and Drop and much more.
167+
168+
### Demo
169+
<https://kzrfaisal.github.io/#/afu>
170+
### Install
171+
```
172+
npm i angular-file-uploader
173+
```
174+
### Usage
175+
- Bootstrap.min.css is required.
176+
Include
177+
```html
178+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
179+
```
180+
in your index.html.
181+
- Import AngularFileUploaderModule inside your app.module.ts
182+
```javascript
183+
import { AngularFileUploaderModule } from "angular-file-uploader";
184+
```
185+
```javascript
186+
@NgModule({
187+
imports: [
188+
...,
189+
AngularFileUploaderModule,
190+
...
191+
]
192+
})
193+
```
194+
##### Example-1 ( with minimal configuration )
195+
```html
196+
<angular-file-uploader
197+
[config]="afuConfig">
198+
</angular-file-uploader>
199+
```
200+
```javascript
201+
afuConfig = {
202+
uploadAPI: {
203+
url:"https://example-file-upload-api"
204+
}
205+
};
206+
```
207+
##### Example-2 ( with all available configuration )
208+
```html
209+
<angular-file-uploader
210+
[config]="afuConfig"
211+
[resetUpload]=resetVar
212+
(ApiResponse)="DocUpload($event)">
213+
</angular-file-uploader>
214+
```
215+
```javascript
216+
afuConfig = {
217+
multiple: false,
218+
formatsAllowed: ".jpg,.png",
219+
maxSize: "1",
220+
uploadAPI: {
221+
url:"https://example-file-upload-api",
222+
method:"POST",
223+
headers: {
224+
"Content-Type" : "text/plain;charset=UTF-8",
225+
"Authorization" : `Bearer ${token}`
226+
}
227+
},
228+
theme: "dragNDrop",
229+
hideProgressBar: true,
230+
hideResetBtn: true,
231+
hideSelectBtn: true,
232+
replaceTexts: {
233+
selectFileBtn: 'Select Files',
234+
resetBtn: 'Reset',
235+
uploadBtn: 'Upload',
236+
dragNDropBox: 'Drag N Drop',
237+
attachPinBtn: 'Attach Files...',
238+
afterUploadMsg_success: 'Successfully Uploaded !',
239+
afterUploadMsg_error: 'Upload Failed !'
240+
};
241+
};
242+
```
243+
244+
| **Properties** | **Description** | **Default Value** |
245+
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
246+
| 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. | {} |
247+
| 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. | |
248+
| 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 |
249+
250+
251+
| **[config]** | **Description** | **Default Value** |
252+
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
253+
| multiple : boolean | Set it as " true " for uploading multiple files at a time and as " false " for single file at a time. | false |
254+
| formatsAllowed : string | Specify the formats of file you want to upload. | '.jpg,.png,.pdf,.docx, .txt,.gif,.jpeg'|
255+
| maxSize : number | Maximum size limit for files in MB. | 20 MB |
256+
| uploadAPI.url : string | Complete api url to which you want to upload. | undefined |
257+
| uploadAPI.method : string | HTTP method to use for upload. | POST |
258+
| uploadAPI.headers : {} | Provide headers you need here. | {} |
259+
| 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.|
260+
| hideProgressBar:boolean | Set it as " true " to hide the Progress bar. | false |
261+
| hideResetBtn:boolean | Set it as " true " to hide the 'Reset' Button. | false |
262+
| hideSelectBtn:boolean | Set it as " true " to hide the 'Select File' Button. | false |
263+
| replaceTexts:object | Replace default texts with your own custom texts. | refer to example-2|
264+
265+
---
266+
##### A Better Way to reset the module
267+
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):-
268+
269+
###### Example-3
270+
```html
271+
<angular-file-uploader #fileUpload1
272+
[config]="afuConfig"
273+
[resetUpload]=resetVar
274+
(ApiResponse)="DocUpload($event)">
275+
</angular-file-uploader>
276+
```
277+
- Assign one local reference variable (here 'fileUpload1') to the component.
278+
- Now use this local reference variable in your xyz.component.ts file.
279+
```javascript
280+
@ViewChild('fileUpload1')
281+
private fileUpload1: AngularFileUploaderComponent;
282+
```
283+
- Remember to import ViewChild and AngularFileUploaderComponent properly in your component.
284+
```javascript
285+
import { ViewChild } from '@angular/core';
286+
import { AngularFileUploaderComponent } from "angular-file-uploader";
287+
```
288+
- That's it.....all done, now just use
289+
```javascript
290+
this.fileUpload1.resetFileUpload();
291+
```
292+
to reset the module hassle-free anytime.
293+
294+
### Styling:
295+
###### Following classes are available for customisation :
296+
###### *Include them in your global css class (src/styles.css)*
297+
###### *Use '!important' if something doesn't works*
298+
- .afu-select-btn {}
299+
- .afu-reset-btn {}
300+
- .afu-upload-btn {}
301+
- .afu-dragndrop-box {}
302+
- .afu-dragndrop-text {}
303+
- .afu-constraints-info {}
304+
- .afu-valid-file {}
305+
- .afu-invalid-file {}
306+
- .afu-progress-bar {}
307+
- .afu-upload-status {}
308+
- .afu-attach-pin {}
309+
310+
##### Points to note:
311+
- Files are uploaded in FormData format.
312+
313+
### Coming Soon:
314+
- More themes.
315+
- More customization options.
316+
---
317+
---
161318
#### For Versions < 5.x :
162319
Angular file uploader is an Angular 2/4/5/6 file uploader module with Real-Time Progress Bar, Angular Universal Compatibility and multiple themes which includes Drag and Drop and much more.
163320

0 commit comments

Comments
 (0)