Updated: prettify the solution
This commit is contained in:
@@ -8,7 +8,7 @@ import {FileUploader} from './file-uploader';
|
||||
|
||||
@Directive({
|
||||
selector: '[ng2-file-drop]',
|
||||
properties: ['config: ng2FileDrop', 'uploader'],
|
||||
properties: ['uploader'],
|
||||
events: ['fileOver'],
|
||||
host: {
|
||||
'(drop)': 'onDrop($event)',
|
||||
@@ -18,7 +18,6 @@ import {FileUploader} from './file-uploader';
|
||||
})
|
||||
export class FileDrop {
|
||||
public uploader:FileUploader;
|
||||
public config:any = {};
|
||||
private fileOver:EventEmitter = new EventEmitter();
|
||||
|
||||
constructor(private element:ElementRef) {
|
||||
|
||||
@@ -10,14 +10,13 @@ import {FileUploader} from './file-uploader';
|
||||
|
||||
@Directive({
|
||||
selector: '[ng2-file-select]',
|
||||
properties: ['config: ng2FileSelect', 'uploader'],
|
||||
properties: ['uploader'],
|
||||
host: {
|
||||
'(change)': 'onChange()'
|
||||
}
|
||||
})
|
||||
export class FileSelect {
|
||||
public uploader:FileUploader;
|
||||
public config:any = {};
|
||||
|
||||
constructor(private element:ElementRef) {
|
||||
}
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
export * from './file-upload/file-select';
|
||||
export * from './file-upload/file-drop';
|
||||
export * from './file-upload/file-uploader';
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<h3>Select files</h3>
|
||||
|
||||
<div [ng2-file-drop]=""
|
||||
<div ng2-file-drop
|
||||
[ng-class]="{'nv-file-over': hasBaseDropZoneOver}"
|
||||
(file-over)="fileOverBase($event)"
|
||||
[uploader]="uploader"
|
||||
@@ -28,7 +28,7 @@
|
||||
Base drop zone
|
||||
</div>
|
||||
|
||||
<div [ng2-file-drop]=""
|
||||
<div ng2-file-drop
|
||||
[ng-class]="{'another-file-over-class': hasAnotherDropZoneOver}"
|
||||
(file-over)="fileOverAnother($event)"
|
||||
[uploader]="uploader"
|
||||
@@ -37,10 +37,10 @@
|
||||
</div>
|
||||
|
||||
Multiple
|
||||
<input type="file" [ng2-file-select]="" [uploader]="uploader" multiple /><br/>
|
||||
<input type="file" ng2-file-select [uploader]="uploader" multiple /><br/>
|
||||
|
||||
Single
|
||||
<input type="file" [ng2-file-select]="" [uploader]="uploader" />
|
||||
<input type="file" ng2-file-select [uploader]="uploader" />
|
||||
</div>
|
||||
|
||||
<div class="col-md-9" style="margin-bottom: 40px">
|
||||
|
||||
@@ -5,14 +5,13 @@ import {
|
||||
CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgStyle
|
||||
} from 'angular2/angular2';
|
||||
|
||||
import {FileSelect, FileDrop} from '../../../components/index';
|
||||
import {FileUploader} from '../../../components/file-upload/file-uploader';
|
||||
import {FileSelect, FileDrop, FileUploader} from '../../../components/index';
|
||||
|
||||
// webpack html imports
|
||||
let template = require('./simple-demo.html');
|
||||
|
||||
// const URL = '/api/';
|
||||
const URL = 'https://evening-anchorage-3159.herokuapp.com/api/';
|
||||
const URL = '/api/';
|
||||
// const URL = 'https://evening-anchorage-3159.herokuapp.com/api/';
|
||||
|
||||
@Component({
|
||||
selector: 'simple-demo'
|
||||
|
||||
Reference in New Issue
Block a user