Socket
Book a DemoInstallSign in
Socket

ng-input-file

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-input-file

A component that wraps input[type=file] element styled with Material

0.0.4
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

ng-input-file

npm npm License

This library provides a component input-file that wraps a legacy input[type=file] element styled with Material components:

// legacy input
<input type="file" accept="image/*, video/*" (change)="fileChanged($event)">

// using a component
<input-file (files)="fileChanged($event)" #input1></input-file>

input-file component emits (files) output whenever user chooses or removes a file. By default, the component accepts image/*, video/* and you can override it by providing optional input like [accept]="'image/*'".

A Stackblitz demo is available to show the usage.

// to install
npm install ng-input-file --save
yarn add ng-input-file

// in app.module.ts
import { NgInputFileModule } from 'ng-input-file';
@NgModule({
  imports: [
    NgInputFileModule,

// in template
<input-file (files)="fileChanged($event)" #input1></input-file>

// in component
import { NgInputFileComponent } from 'ng-input-file';

@ViewChild('input1')
private input1: NgInputFileComponent;

fileChanged({ files }) {
  console.log(`fileChanged ${files.length}`, files, this.input1.filename);
}

Keywords

angular

FAQs

Package last updated on 18 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.