11.1.5 • Published 8 months ago

opex-mat-file-upload v11.1.5

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
8 months ago

Angular Material File Upload npm Build Status

This is a clone of https://github.com/bjsawyer/mat-file-upload, it was published in older versions of Angular and its not compatable with newer versions of newer versions of Angualr 12,13,14 and 15 and so on. So I have upgraded it to Angular 15 and no code changes are made.

This tool is a simple & configurable file upload component for use with Angular Material.

Live Demo: https://bjsawyer.github.io/mat-file-upload/

Prerequisites

In order to use mat-file-upload in your app, you must have the following dependencies installed:

Usage

  1. Install package from npm (npm i mat-file-upload).
  2. Add MatFileUploadModule to your module's imports, like so:
@NgModule({
  declarations: [AppComponent],
  imports: [
    ...
    MatFileUploadModule,
    ...
  ],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}
  1. Add the element to your template, like so:

Basic:

<mat-file-upload></mat-file-upload>

Advanced:

<mat-file-upload
  [labelText]="'Select a file (or multiple) to upload:'"
  [selectButtonText]="'Choose File(s)'"
  [selectFilesButtonType]="button"
  [uploadButtonText]="'Submit'"
  [uploadButtonType]="submit"
  [allowMultipleFiles]="true"
  [showUploadButton]="true"
  [customSvgIcon]="'close_custom'"
  [acceptedTypes]="'.png, .jpg, .jpeg'"
  (uploadClicked)="onUploadClicked($event)"
  (selectedFilesChanged)="onSelectedFilesChanged($event)"
>
</mat-file-upload>

Options

@Input() Properties

DirectiveTypeDescriptionDefault Value
[labelText]stringThe text to be displayed for the file upload label"Select file(s)"
[selectButtonText]stringThe text to be displayed for the button that allows the user to select file(s)"Select file(s)"
[selectFilesButtonType]stringThe HTML "type" attribute of the "Select Files" button"button"
[uploadButtonText]stringThe text to be displayed for the button that allows the user to upload file(s)"Upload File(s)"
[uploadButtonType]stringThe HTML "type" attribute of the "Upload" button"button"
[allowMultipleFiles]booleanTrue/false representing whether the user can select multiple files at a timefalse
[showUploadButton]booleanTrue/false representing whether the "Upload" button is shown in the DOMtrue
[customSvgIcon]stringThe name of the custom svgIcon to be used as the "close" button; otherwise defaults to Material's "close" iconnull
[acceptedTypes]stringThe list of file types that are allowed to be uploaded"*.*"

@Output() Properties

DirectiveTypeDescription
(uploadClicked)EventEmitter<FileList>Event handler that emits the list of selected files whenever the "Upload" button is clicked
(selectedFilesChanged)EventEmitter<FileList>Event handler that emits the list of selected files whenever the user changes file selection
11.1.5

8 months ago

11.1.4

8 months ago

11.1.3

8 months ago