Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Subject } from 'rxjs';
- import { ajax as rxAjax } from 'rxjs/ajax';
- import { merge } from 'rxjs/operators';
- let form_data = new FormData();
- form_data.append( 'key', 'value' );
- const progressSubscriber = new Subject();
- let request$ = rxAjax({
- url: 'http://localhost.com/some-api',
- method: 'POST',
- crossDomain: true,
- withCredentials: true,
- body: form_data,
- progressSubscriber
- });
- progressSubscriber
- .pipe( merge(request$) )
- .subscribe( data =>{
- if ( data.hasOwnProperty('status') ) {
- console.log('XHR is DONE');
- }
- });
Add Comment
Please, Sign In to add comment