npm.io
1.0.1 • Published 6 years ago

lf-angular-file-drop

Licence
Version
1.0.1
Deps
0
Size
151 kB
Vulns
0
Weekly
0
Stars
1

Angular Drag and Drop file component

Drag and drop component for angular, without any dependencies.

You simply drag and drop, or click inside.

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

Name Optional Description
(fileDropped) No Returns the file (s) in an event
multiple (boolean) Yes Allows you to recieve one or multiple files, this value is a boolean and false by default
labelBackground (string) Yes Changes the label background color
color (string) Yes Changes the label font color

Examples


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


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

Keywords