1.0.1 • Published 4 years ago

lf-angular-file-drop v1.0.1

Weekly downloads
15
License
-
Repository
github
Last release
4 years ago

Angular Drag and Drop file component

Drag and drop component for angular, without any dependencies.

You simply drag and drop, or click inside.

npm.io

Installation

NPM

npm i lf-angular-file-drop

Implementation

Just add the DragNDropModule to your app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

import { AppComponent } from './app.component';
import { DragNDropModule } from 'drag-n-drop';


@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    DragNDropModule
  ],
  providers: [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  bootstrap: [AppComponent]
})
export class AppModule { }

and use it in your html:

  <lf-drag-n-drop 
    multiple="true"
    labelBackground="green"
    color="white"
    (fileDropped)="handleFiles($event)">
  </lf-drag-n-drop>

Properties

NameOptionalDescription
(fileDropped)NoReturns the file (s) in an event
multiple (boolean)YesAllows you to recieve one or multiple files, this value is a boolean and false by default
labelBackground (string)YesChanges the label background color
color (string)YesChanges the label font color

Examples

  <lf-drag-n-drop 
    multiple="true"
    labelBackground="green"
    color="white"
    (fileDropped)="handleFiles($event)">
  </lf-drag-n-drop>

npm.io

  <lf-drag-n-drop 
    labelBackground="white"
    color="purple"
    (fileDropped)="handleFiles($event)">
  </lf-drag-n-drop>

npm.io