Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import { Component, OnInit } from '@angular/core';
import { FileItem, HttpClientUploadService } from '@wkoza/ngx-upload';
@Component({
selector: 'app-root',
templateUrl: './simple.component.html',
styleUrls: ['./simple.component.css']
})
export class SimpleBootstrapComponent implements OnInit {
constructor(public uploader: HttpClientUploadService) { }
ngOnInit() {
this.uploader.onCancel$.subscribe(
(data: FileItem) => {
console.log('file deleted: ' + data.file);
});
this.uploader.onProgress$.subscribe(
(data: any) => {
console.log('upload file in progree: ' + data.progress);
});
this.uploader.onSuccess$.subscribe(
(data: any) => {
console.log(`upload file successful: ${data.item} ${data.body} ${data.status} ${data.headers}`);
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment