<!DOCTYPE html>
<html>

<head>
  <base href="." />
  <title>Angular File Dropzone Demo</title>
  <link href="node_modules/@angular/material/prebuilt-themes/indigo-pink.css" rel="stylesheet">
  <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
  <link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
  <link rel="stylesheet" href="style.css" />
  <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script>
  <script src="https://unpkg.com/zone.js/dist/zone.js"></script>
  <script src="https://unpkg.com/zone.js/dist/long-stack-trace-zone.js"></script>
  <script src="https://unpkg.com/reflect-metadata@0.1.3/Reflect.js"></script>
  <script src="https://unpkg.com/systemjs@0.19.31/dist/system.js"></script>
  <script src="config.js"></script>
  <script>
    System.import('app')
      .catch(console.error.bind(console));
  </script>
</head>

<body>
  <my-app>
    Loading...
  </my-app>
</body>

</html>
html {
  line-height: 1.4;
}

body, html {
  height: 100%;
  min-height: 100%;
  position: relative;
}

body {
  background: rgb(250, 250, 250);
  color: rgba(0, 0, 0, 0.87);
  font-size: 14px;
  line-height: 20px;
  margin: 0;
  padding: 0;
}

button, html, input, select, textarea {
  font-family: 'Roboto', 'Helvetica Neue', sans-serif;
}

.md-headline {
  font-size: 24px;
  font-weight: 400;
  line-height: 32px;
}

.md-title {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: .005em;
}

[md-button], [md-raised-button] {
  text-transform: uppercase;
}
### Angular File Dropzone Demo
System.config({
  //use typescript for compilation
  transpiler: 'typescript',
  //typescript compiler options
  typescriptOptions: {
    emitDecoratorMetadata: true
  },
  paths: {
    'npm:': 'https://unpkg.com/'
  },
  //map tells the System loader where to look for things
  map: {
    
    'app': './src',
    'angular-file-dropzone': 'npm:angular-file-dropzone@^1.0.0',
    
    '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
    '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
    '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
    '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
    '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
    '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
    '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
    '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
    '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
    '@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
    '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
    '@angular/material': 'npm:@angular/material/bundles/material.umd.js',
    
    '@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
    '@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
    '@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
    '@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
    '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
    '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
    '@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
    
    'rxjs': 'npm:rxjs',
    'typescript': 'npm:typescript@2.2.1/lib/typescript.js'
  },
  //packages defines our app package
  packages: {
    app: {
      main: './main.ts',
      defaultExtension: 'ts'
    },
    rxjs: {
      defaultExtension: 'js'
    },
    'angular-file-dropzone': {
      main: 'index.js',
      defaultExtension: 'js'
    }
  }
});
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule);
import { Component } from '@angular/core';

import { DroppedFile } from './dropped-file';

@Component({
  selector: 'my-app',
  templateUrl: './src/app.component.html',
  styleUrls: ['./src/app.component.scss']
})
export class AppComponent {
  public files: Array<DroppedFile> = [];
  
  addFile(file: DroppedFile) {
    this.files.push(file);
  }
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MaterialModule } from '@angular/material';
import { FileDropzoneModule } from 'angular-file-dropzone';

import { AppComponent } from './app.component.ts';

@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    MaterialModule
    FileDropzoneModule
  ],
  declarations: [ AppComponent ],
  bootstrap: [ AppComponent ]
})
export class AppModule {
}
<md-toolbar color="primary">
  <h1 class="md-headline">Angular File Dropzone Demo</h1>
  <span class="filler"></span>
  <a href="https://github.com/fvilers/angular-file-dropzone" md-button>GitHub</a>
</md-toolbar>

<main>
  <h2 class="title">Drop a file</h2>
  
  <div ngFileDropzone (fileDrop)="addFile($event)" [ngClass]="{'hover': isHover }" (dragenter)="isHover = true" (dragleave)="isHover = false" (drop)="isHover = false">
    <md-icon class="big">file_upload</md-icon>
  </div>
  
  <h2 *ngIf="files.length">Dropped files</h2>
  <ul>
    <li *ngFor="let file of files">
      {{file.name}} ({{file.size}} bytes)
    </li>
  </ul>
</main>
.filler {
  flex: 1 1 auto;
}

main {
  padding: 20px;
}

[ngFileDropZone] {
  align-items: center;
  background: lightgrey;
  border: dashed 1px grey;
  display: flex;
  justify-content: center;
  height: 350px;
  width: 500px;
}
  
.hover {
  background: grey;
  border: dashed 1px darkgrey;
}
  
.big {
  font-size: 96px;
  height: 96px;
  width: 96px;
}