import { ChangeDetectionStrategy , Component } from '@angular/core' ; import { Uploader , UploadxOptions , UploadxService } from 'ngx-uploadx' ; import { Observable } from 'rxjs' ; import { environment } from '../../../environments/environment' ; @ Component ( { selector : 'app-a' , templateUrl : './a.component.html' , changeDetection : ChangeDetectionStrategy . OnPush , providers : [ UploadxService ] } ) export class AComponent { uploads$ : Observable < Uploader [ ] > ; options : UploadxOptions = { endpoint : `${ environment . api }/files?uploadType=uploadx` } ; constructor ( private uploadService ) { this . uploads$ = this . uploadService . connect ( this . options ) ; } cancelAll ( ) { this . uploadService . control ( { action : 'cancel' } ) ; } pauseAll ( ) { this . uploadService . control ( { action : 'pause' } ) ; } uploadAll ( ) { this . uploadService . control ( { action : 'upload' } ) ; } }