npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-material-fileupload

v3.0.2

Published

A fileupload component based on angular-material design

Downloads

5,143

Readme

angular-material-fileupload npm version

A fileupload component based on angular-material design

Documentation

angular-material-fileupload API doc

Demo

Setup

The module to be imported is "MatFileUploadModule"


import { NgModule } from '@angular/core';
import { BrowserModule }  from '@angular/platform-browser';
import { MatButtonModule } from '@angular/material';

import { AppComponent } from './app.component';
import { MatFileUploadModule } from 'angular-material-fileupload';

@NgModule({
  imports: [
    MatButtonModule,
    BrowserModule,
    MatFileUploadModule
  ],
  declarations: [
    AppComponent
  ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }

File upload Example

Screenshot

<label for="singleFile">Upload file</label>
<input id="singleFile" type="file" [fileUploadInputFor]= "fileUploadQueue"/>
<br>

<mat-file-upload-queue #fileUploadQueue
    [fileAlias]="'file'"
    [httpUrl]="'http://localhost:8180/jax-rs-jersey-application-sample'">

    <mat-file-upload [file]="file" [id]="i" *ngFor="let file of fileUploadQueue.files; let i = index"></mat-file-upload>
</mat-file-upload-queue>

Notes

  • 'fileUploadQueue' is the template input variable which point to the queue. You can see its created in the queue tag (#fileUploadQueue). Basically pointing the input to the queue
  • fileAlias and httpUrl are input variables which you can bind. 'fileAlias' - as you might guess just the alias of the file. and 'httpUrl' is the url you want to do POST with multipart data.

Drag and drop example

Screenshot


<div [fileUploadInputFor]="fileUploadQueue" class="upload-drop-zone">
    Just drag and drop files here
</div>


<div style="width: 500px">
    <mat-file-upload-queue #fileUploadQueue
        [fileAlias]="'file'"
        [httpUrl]="'http://localhost:8180/jax-rs-jersey-application-sample'" multiple>

        <mat-file-upload [file]="file" [id]="i" *ngFor="let file of fileUploadQueue.files; let i = index"></mat-file-upload>
    </mat-file-upload-queue>
</div>

Example setting the inputs on mat-file-upload-queue


<div [fileUploadInputFor]="fileUploadQueue3" class="upload-drop-zone">
  Just drag and drop files here
</div>

<div style="width: 500px">
  <mat-file-upload-queue
    #fileUploadQueue3
    [httpUrl]="'http://localhost:8080/jax-rs-jersey-application-sample'"
    fileAlias="{{ fileAlias }}"
    [httpRequestHeaders]="httpRequestHeaders"
    [httpRequestParams]="httpRequestParams"
  >
    <mat-file-upload
      [file]="file"
      [id]="i"
      *ngFor="let file of fileUploadQueue3.files; let i = index"
    ></mat-file-upload>
  </mat-file-upload-queue>
</div>

Example setting the inputs overridden on mat-file-upload


<div [fileUploadInputFor]="fileUploadQueue4" class="upload-drop-zone">
  Just drag and drop files here
</div>

<div style="width: 500px">
  <mat-file-upload-queue
    #fileUploadQueue4
    [httpUrl]="'http://localhost:8080/jax-rs-jersey-application-sample1'"
    fileAlias="{{ fileAlias }}"
    [httpRequestHeaders]="httpRequestHeaders"
    [httpRequestParams]="httpRequestParams"
  >
    <mat-file-upload
      [file]="file"
      [id]="i"
      *ngFor="let file of fileUploadQueue4.files; let i = index"
      [httpUrl]="'http://localhost:8080/jax-rs-jersey-application-sample'"
      fileAlias="{{ fileAlias1 }}"
      [httpRequestHeaders]="httpRequestHeaders1"
      [httpRequestParams]="httpRequestParams1"
    ></mat-file-upload>
  </mat-file-upload-queue>
</div>