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

ngx-file-up

v1.4.7

Published

File uploading plugin for AngularX applications.

Downloads

85

Readme

NgxFileUp

File uploading plugin for AngularX applications.

Install

Run npm i ngx-file-up --save to install and save as dependency.

Import

Add import { NgxFileUpModule } from 'ngx-file-up' to your app module. Then add NgxFileUpModule to ng module imports.

Options

Directives

| Option | Type | Default Val | Description | | ----------------- | ------------ | ------------ | --------------------------------------------------- | | [prompt] | string | Select Files | Prompt message displayed before files select button | | [promptAllow] | boolean | false | Hide or show prompt message | | [selectBtn] | string | Select | The text inside files select button | | [uploadBtn] | string | Upload | The text inside files upload button | | [uploadBtnAllow] | boolean | true | Hide or show upload button | | [multiple] | boolean | true | Allow multiple files | | [types] | string | *.* | The list of allowed file types | | [ngxTriggerReset] | EventEmitter | | Event received as input to trigger plugin reset |

Events

| Event | Type | Description | | ---------------------- | ------------------------ | ------------------------------------------------------------------------ | | (ngxTriggerUpload) | EventEmitter<FileList> | Event handler to emit selected files when the "Upload" button is clicked | | (ngxTriggerSelected) | EventEmitter<FileList> | Event handler to emit selected files when files are selected |

Usage

Add this to HTML file.

<ngx-file-up></ngx-file-up>

[ngxTriggerReset]

app.component.html

<div>
  <ngx-file-up
    [prompt]="'Upload Files Here'"
    [promptAllow]="true"
    [selectBtn]="'Choose File(s)'"
    [uploadBtn]="'Submit'"
    [multiple]="true"
    [uploadBtnAllow]="true"
    [types]="'.pdf, .jpg, .png'"
    [ngxTriggerReset]="emitter"
  >
  </ngx-file-up>
  <br />
  <br />
  <div>This button will emit an event to remove all the selected files.</div>
  <br />
  <button class="ripple" (click)="resetFiles()" (ngxFileUpReset)="checkevent()">
    Reset Files
  </button>
</div>

app.component.ts

import { Component, EventEmitter, Output } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {

  @Output() emitter: EventEmitter<any> = new EventEmitter();

  constructor() { }

  resetFiles() {
    this.emitter.emit();
  }

}

Events

app.component.html

<div>
  <ngx-file-up
    [prompt]="'Upload Files Here'"
    [promptAllow]="true"
    [selectBtn]="'Choose File(s)'"
    [uploadBtn]="'Submit'"
    [multiple]="true"
    [uploadBtnAllow]="true"
    [types]="'.pdf, .jpg, .png'"
    [ngxTriggerReset]="emitter"
    (ngxTriggerSelected)="triggerOnSelected($event)"
    (ngxTriggerUpload)="triggerOnUpload($event)"
  >
  </ngx-file-up>
  <br />
  <br />
  <div>This button will emit an event to remove all the selected files.</div>
  <br />
  <button class="ripple" (click)="resetFiles()" (ngxFileUpReset)="checkevent()">
    Reset Files
  </button>
</div>

app.component.ts

import { Component, EventEmitter, Output } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {

  @Output() emitter: EventEmitter<any> = new EventEmitter();

  constructor() { }

  // console list of files selected
  triggerOnSelected(files?: FileList) {
    console.log(files);
  }

  // console list of files selected on upload click
  triggerOnUpload(files?: FileList) {
    console.log(files);
  }

  resetFiles() {
    this.emitter.emit();
  }

}

Credit

Credit goes to "bjsawyer" for creating "mat-file-upload"