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