so I'm trying to make an accurate progress bar that fills up based on the my ajax call.
This helped but I think that perhaps things have changed a little since it was written.
So I have my CustomBrowserXhr that I've added to my App Module providers to ovverride the BrowserXhr:-
@Injectable()
export class CustomBrowserXhr extends BrowserXhr {
constructor(private service: ProgressService) {}
build(): any {
let xhr = super.build();
xhr.onprogress = (event) => {
console.log(event, "event inside browser override");
this.service.progressEventObservable.next(event);
};
return <any>(xhr);
}
}
I then have a very basic progress service which other components can subscribe to:-
@Injectable()
export class ProgressService {
progressEventObservable:Subject<any> = new Subject();
progressEvent$ = this.progressEventObservable.asObservable();
}
I thought that I could just make http calls and I would see the console log "event inside browser override" - as it is I just get the error "EXCEPTION: browserXHR.build is not a function". Can someone shed some light one what's going wrong here please?
Thanks in advance.