@anguless/angulux/fileupload
FileUpload
import
import { FileUploadModule } from '@anguless/angulux/fileupload';Basic
Basic mode is a single choose control; customUpload hands the files to your own code instead of posting them.
<agl-fileUpload mode="basic" chooseLabel="Choose a file" accept="image/*" [maxFileSize]="1000000" [customUpload]="true" (uploadHandler)="onUpload($event)" /><span>{{ chosen() }}</span>Advanced
The full control adds drag and drop, a file list and progress.
Drag and drop files here to upload.
<div style="width: 100%"> <agl-fileUpload [multiple]="true" accept="image/*" [maxFileSize]="1000000" [customUpload]="true" (uploadHandler)="onUpload($event)"> <ng-template #empty> <p>Drag and drop files here to upload.</p> </ng-template> </agl-fileUpload></div>Icons
chooseIcon, uploadIcon and cancelIcon put an icon class of your own on each button. In basic mode the one button shows uploadIcon once a file is chosen. The icons are decorative: each button is named by its label.
<agl-fileUpload mode="basic" chooseLabel="Choose an image" chooseIcon="pi pi-image" uploadIcon="pi pi-cloud-upload" accept="image/*" [maxFileSize]="1000000" [customUpload]="true" (uploadHandler)="onUpload($event)" /><div style="width: 100%; margin-top: 1.5rem"> <agl-fileUpload [multiple]="true" chooseIcon="pi pi-images" uploadIcon="pi pi-cloud-upload" cancelIcon="pi pi-ban" accept="image/*" [maxFileSize]="1000000" [customUpload]="true" (uploadHandler)="onUpload($event)" /></div>API
Generated from the committed corpus, which check:corpus holds to the built library.
FileContent
component[aglFileContent]| Input | Type | Default | Description |
|---|---|---|---|
| files | any | not documented | |
| badge | 'secondary' | 'info' | 'success' | 'warn' | 'danger' | 'contrast' | not documented | |
| badge | string | not documented | |
| preview | number | not documented | |
| file | any | not documented |
| Output | Type | Description |
|---|---|---|
| on | any |
Inherited from BaseComponent
inherited| Input | Type | Default | Description |
|---|---|---|---|
| dt | Object | undefined | undefined | Defines scoped design tokens of the component. |
| unstyled | boolean | undefined | undefined | Indicates whether the component should be rendered without styles. |
| pt | PT | undefined | undefined | Used to pass attributes to DOM elements inside the component. Keys become attributes, and a key that names a DOM property is also assigned to that property. Values the browser would execute go through Angular's sanitizer first, as in a template binding: markup in `innerHTML`, `outerHTML` and `srcdoc`, and URLs in `href`, `src`, `action`, `formaction` and `xlink:href`. To write one of those unsanitized on purpose, pass a `DomSanitizer.bypassSecurityTrustHtml` or `bypassSecurityTrustUrl` value. An `on*` key must be a function, and any other value for it is ignored. Keys themselves are applied as given, so let data from users choose values, never keys. |
| pt | PassThroughOptions | undefined | undefined | Used to configure passthrough(pt) options of the component. |
FileUpload
componentagl-fileupload, agl-fileUploadFileUpload is an advanced uploader with dragdrop support, multi file uploads, auto uploading, progress tracking and validations.
| Input | Type | Default | Description |
|---|---|---|---|
| name | string | undefined | not documented | Name of the request parameter to identify the files at backend. |
| url | string | undefined | not documented | Remote url to upload the files. |
| method | 'post' | 'put' | undefined | not documented | HTTP method to send the files to the url such as "post" and "put". |
| multiple | boolean | undefined | not documented | Used to select multiple files at once from file dialog. |
| accept | string | undefined | not documented | Comma-separated list of pattern to restrict the allowed file types. Can be any combination of either the MIME types (such as "image/*") or the file extensions (such as ".jpg"). |
| disabled | boolean | undefined | not documented | Disables the upload functionality. |
| auto | boolean | undefined | not documented | When enabled, upload begins automatically after selection is completed. |
| with | boolean | undefined | not documented | Cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates. |
| max | number | undefined | not documented | Maximum file size allowed in bytes. |
| invalid | string | not documented | Summary message of the invalid file size. |
| invalid | string | not documented | Detail message of the invalid file size. |
| invalid | string | not documented | Summary message of the invalid file type. |
| invalid | string | not documented | Detail message of the invalid file type. |
| invalid | string | not documented | Detail message of the invalid file type. |
| invalid | string | not documented | Summary message of the invalid file type. |
| style | { [klass: string]: any } | null | undefined | not documented | Inline style of the element. |
| style | string | undefined | not documented | Class of the element. |
| preview | number | not documented | Width of the image thumbnail in pixels. |
| choose | string | undefined | not documented | Label of the choose button. Defaults to AnguluxConfig Locale configuration. |
| upload | string | undefined | not documented | Label of the upload button. Defaults to AnguluxConfig Locale configuration. |
| cancel | string | undefined | not documented | Label of the cancel button. Defaults to AnguluxConfig Locale configuration. |
| choose | string | undefined | not documented | Icon of the choose button. |
| upload | string | undefined | not documented | Icon of the upload button. |
| cancel | string | undefined | not documented | Icon of the cancel button. |
| show | boolean | not documented | Whether to show the upload button. |
| show | boolean | not documented | Whether to show the cancel button. |
| mode | 'advanced' | 'basic' | undefined | not documented | Defines the UI of the component. |
| headers | HttpHeaders | undefined | not documented | HttpHeaders class represents the header configuration options for an HTTP request. |
| custom | boolean | undefined | not documented | Whether to use the default upload or a manual implementation defined in uploadHandler callback. Defaults to AnguluxConfig Locale configuration. |
| file | number | undefined | not documented | Maximum number of files that can be uploaded. |
| upload | string | undefined | not documented | Style class of the upload button. |
| cancel | string | undefined | not documented | Style class of the cancel button. |
| remove | string | undefined | not documented | Style class of the remove button. |
| choose | string | undefined | not documented | Style class of the choose button. |
| choose | ButtonProps | not documented | Used to pass all properties of the ButtonProps to the choose button inside the component. |
| upload | ButtonProps | not documented | Used to pass all properties of the ButtonProps to the upload button inside the component. |
| cancel | ButtonProps | not documented | Used to pass all properties of the ButtonProps to the cancel button inside the component. |
| files | not documented |
| Output | Type | Description |
|---|---|---|
| on | EventEmitter<FileBeforeUploadEvent> | Callback to invoke before file upload is initialized. |
| on | EventEmitter<FileSendEvent> | An event indicating that the request was sent to the server. Useful when a request may be retried multiple times, to distinguish between retries on the final event stream. |
| on | EventEmitter<FileUploadEvent> | Callback to invoke when file upload is complete. |
| on | EventEmitter<FileUploadErrorEvent> | Callback to invoke if file upload fails. |
| on | EventEmitter<Event> | Callback to invoke when files in queue are removed without uploading using clear all button. |
| on | EventEmitter<FileRemoveEvent> | Callback to invoke when a file is removed without uploading using clear button of a file. |
| on | EventEmitter<FileSelectEvent> | Callback to invoke when files are selected. |
| on | EventEmitter<FileProgressEvent> | Callback to invoke when files are being uploaded. |
| upload | EventEmitter<FileUploadHandlerEvent> | Callback to invoke in custom upload mode to upload the files manually. |
| on | EventEmitter<Event> | This event is triggered if an error occurs while loading an image file. |
| on | EventEmitter<RemoveUploadedFileEvent> | This event is triggered if an error occurs while loading an image file. |
| Template slot | Description |
|---|---|
| <ng-template #file> | Custom file template. |
| <ng-template #header> | Custom header template. |
| <ng-template #content> | Custom content template. |
| <ng-template #toolbar> | Custom toolbar template. |
| <ng-template #chooseicon> | Custom choose icon template. |
| <ng-template #filelabel> | Custom file label template. |
| <ng-template #uploadicon> | Custom upload icon template. |
| <ng-template #cancelicon> | Custom cancel icon template. |
| <ng-template #empty> | Custom empty state template. |
Inherited from BaseComponent
inherited| Input | Type | Default | Description |
|---|---|---|---|
| dt | Object | undefined | undefined | Defines scoped design tokens of the component. |
| unstyled | boolean | undefined | undefined | Indicates whether the component should be rendered without styles. |
| pt | PT | undefined | undefined | Used to pass attributes to DOM elements inside the component. Keys become attributes, and a key that names a DOM property is also assigned to that property. Values the browser would execute go through Angular's sanitizer first, as in a template binding: markup in `innerHTML`, `outerHTML` and `srcdoc`, and URLs in `href`, `src`, `action`, `formaction` and `xlink:href`. To write one of those unsanitized on purpose, pass a `DomSanitizer.bypassSecurityTrustHtml` or `bypassSecurityTrustUrl` value. An `on*` key must be a function, and any other value for it is ignored. Keys themselves are applied as given, so let data from users choose values, never keys. |
| pt | PassThroughOptions | undefined | undefined | Used to configure passthrough(pt) options of the component. |