有角度的httpClient请求持续多长时间?

时间:2018-12-17 19:42:10

标签: angular httpclient

有没有办法知道有角度的HttpClient请求执行需要多长时间?

1 个答案:

答案 0 :(得分:1)

public myRequest(): Observable<any>{
    const startTime = performance.now();
    return http.post<any>(url).pipe(
        tap(x => { 
            const endTime = performance.now();
            console.log(`Took ${endTime - startTime} to complete.`);
        })
    )
}