Compare commits
3 Commits
cagdasoezg
...
ravinderpa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36ebe449b0 | ||
|
|
f72aa05e4e | ||
|
|
5b26793662 |
@@ -1,7 +1,14 @@
|
||||
import { FileLikeObject } from './file-like-object.class';
|
||||
import { FileUploader, ParsedResponseHeaders, FileUploaderOptions } from './file-uploader.class';
|
||||
|
||||
import {Observable} from "rxjs/Rx";
|
||||
|
||||
export class FileItem {
|
||||
public observer:any;
|
||||
/**
|
||||
* Observable for subscribing the server result
|
||||
*/
|
||||
public resObservable:Observable;
|
||||
public file:FileLikeObject;
|
||||
public _file:File;
|
||||
public alias:string;
|
||||
@@ -36,6 +43,7 @@ export class FileItem {
|
||||
this.alias = uploader.options.itemAlias || 'file';
|
||||
}
|
||||
this.url = uploader.options.url;
|
||||
this.resObservable=new Observable.create(observer=>{this.observer=observer});
|
||||
}
|
||||
|
||||
public upload():void {
|
||||
|
||||
@@ -96,7 +96,6 @@ export class FileUploader {
|
||||
if (!options) {
|
||||
options = this.options;
|
||||
}
|
||||
|
||||
let temp = new FileLikeObject(some);
|
||||
if (this._isValidFile(temp, arrayOfFilters, options)) {
|
||||
let fileItem = new FileItem(this, some, options);
|
||||
@@ -278,6 +277,7 @@ export class FileUploader {
|
||||
}
|
||||
this.onCompleteAll();
|
||||
this.progress = this._getTotalProgress();
|
||||
this.item.observer.next(response);
|
||||
this._render();
|
||||
}
|
||||
|
||||
@@ -328,7 +328,8 @@ export class FileUploader {
|
||||
let gist = this._isSuccessCode(xhr.status) ? 'Success' : 'Error';
|
||||
let method = '_on' + gist + 'Item';
|
||||
(this as any)[method](item, response, xhr.status, headers);
|
||||
this._onCompleteItem(item, response, xhr.status, headers);
|
||||
this._
|
||||
(item, response, xhr.status, headers);
|
||||
};
|
||||
xhr.onerror = () => {
|
||||
let headers = this._parseHeaders(xhr.getAllResponseHeaders());
|
||||
|
||||
6
src/file-upload/rxjs/operator.ts
Normal file
6
src/file-upload/rxjs/operator.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'rxjs/add/operator/catch';
|
||||
import 'rxjs/add/operator/debounceTime';
|
||||
import 'rxjs/add/operator/distinctUntilChanged';
|
||||
import 'rxjs/add/operator/map';
|
||||
import 'rxjs/add/operator/switchMap';
|
||||
import 'rxjs/add/operator/toPromise';
|
||||
Reference in New Issue
Block a user