Closed
Description
I tried this but for me doesn't function
postUrl = '(Api.getUrl(Api.URLS..........)';
myFormData: FormData ;//populated by ngfFormData directive
httpEvent: HttpEvent<Event>;
uploadFiles(files:File[]) : Subscription {
const config = new HttpRequest('POST', this.postUrl, this.myFormData), {
reportProgress: true
}) // exception [ts] Cannot redeclare block-scoped variable '(Missing)'.
return this.HttpClient.request( config )
.subscribe(event=>{
this.httpEvent = event //exception Type 'HttpEvent<{}>' is not assignable to type 'HttpEvent<Event>'.
if (event instanceof HttpResponse) {
alert('upload complete, old school alert used')
}
},
error=>{
alert('!failure beyond compare cause:' + error.toString())
})
}