Compare commits

...

4 Commits

Author SHA1 Message Date
Ravinder Payal
36ebe449b0 Update file-uploader.class.ts
added (line:280) response pusher (observer.next) for pushing the reponse to subscriber
2017-02-04 21:42:14 +05:30
Ravinder Payal
f72aa05e4e Update file-item.class.ts 2017-02-04 21:38:38 +05:30
Ravinder Payal
5b26793662 Create operator.ts
Contains required rxjs operators' import
2017-02-04 21:23:58 +05:30
Dmitriy Shekhovtsov
cf12851e1d chore(readme): badges updates 2017-01-18 15:19:20 +02:00
4 changed files with 19 additions and 10 deletions

View File

@@ -1,15 +1,9 @@
# ng2-file-upload [![npm version](https://badge.fury.io/js/ng2-file-upload.svg)](http://badge.fury.io/js/ng2-file-upload)
# ng2-file-upload [![npm version](https://badge.fury.io/js/ng2-file-upload.svg)](http://badge.fury.io/js/ng2-file-upload) [![npm downloads](https://img.shields.io/npm/dm/ng2-file-upload.svg)](https://npmjs.org/ng2-file-upload)[![slack](https://ngx-slack.herokuapp.com/badge.svg)](https://ngx-slack.herokuapp.com)
Easy to use Angular2 directives for files upload ([demo](http://valor-software.github.io/ng2-file-upload/))
Follow me [![twitter](https://img.shields.io/twitter/follow/valorkin.svg?style=social&label=%20valorkin)](https://twitter.com/valorkin) to be notified about new releases.
[![Angular 2 Style Guide](https://mgechev.github.io/angular2-style-guide/images/badge.svg)](https://github.com/mgechev/angular2-style-guide)
[![Build Status](https://travis-ci.org/valor-software/ng2-file-upload.svg?branch=master)](https://travis-ci.org/valor-software/ng2-file-upload)
[![Code Climate](https://codeclimate.com/github/valor-software/ng2-file-upload/badges/gpa.svg)](https://codeclimate.com/github/valor-software/ng2-file-upload)
[![Join the chat at https://gitter.im/valor-software/ng2-bootstrap](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/valor-software/ng2-bootstrap?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/valor-software/ng2-file-upload.svg?branch=development)](https://travis-ci.org/valor-software/ng2-file-upload)
[![Dependency Status](https://david-dm.org/valor-software/ng2-file-upload.svg)](https://david-dm.org/valor-software/ng2-file-upload)
[![devDependency Status](https://david-dm.org/valor-software/ng2-file-upload/dev-status.svg)](https://david-dm.org/valor-software/ng2-file-upload#info=devDependencies)
[![Throughput Graph](https://graphs.waffle.io/valor-software/ng2-file-upload/throughput.svg)](https://waffle.io/valor-software/ng2-file-upload/metrics)
## Quick start

View File

@@ -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 {

View File

@@ -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());

View 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';