Skip to content

Instantly share code, notes, and snippets.

@wKoza
Created March 5, 2019 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wKoza/48b04a7804d48c8c828e0e0aa33fd8de to your computer and use it in GitHub Desktop.
Save wKoza/48b04a7804d48c8c828e0e0aa33fd8de to your computer and use it in GitHub Desktop.
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