0.0.7 • Published 10 months ago

ng-file-picker v0.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

Ng File Picker

This is a configurable file picker build for Angular applications.
Supports (Angular 2+) versions.

Installation:

  1. Download from npm:
    npm install ng-file-picker --save
  2. Import the NgFilePickerModule module:
    import { NgFilePickerModule } from 'ng-file-picker';
  3. Add NgFilePickerModule to your module imports:

Usage

Put the ng-file-picker component wherever you need it.

Attributes (Input):

NameTypeDefaultDescription
idStringundefinedUnique identifier of your input filed.
nameStringundefinedUnique name of your input
multipleBooleanfalseIf true, the file picker allows to upload multiple files else it alows only one file at a time.
disabledBooleanfalseTracks whether the control is disabled
formControlNameStringundefinedForm control name of your field which is specified in the FormGroup.
ngModelVariableundefinedTracks the value bound to this directive.

Methods (Output):

NameDescription
changeEvent bound to classical input change event
ngModelChangeEvent emitter for producing the ngModelChange event after the view model update

API:

Container component:

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

@Component({  
selector: 'my-container',  
template: `  
<ng-file-picker id="test" name="file" [(ngModel)]="file" (ngModelChange)="getFile($event)" multiple="false"></ng-file-picker>  
`  
});
export class MyContainerComponent implements OnInit {
  file: any;

  getFile(event: any) {
    console.log("event", event, this.file);
    ....
  }
}

Container Module:

import { NgFilePickerModule } from 'ng-file-picker';
import { MyContainerComponent } from './my-container.component';

@NgModule({
  declarations: [
    MyContainerComponent
  ],
  imports: [
    ...,
    NgFilePickerModule
  ]
})

export class MyContainerModule { }
0.0.5

12 months ago

0.0.4

12 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago